Prepare interface config for bridging on server First, use netplan to configure a bridge device using
the desired ethernet device.
$ c a t / e t c / n e t p l a n /01− n e t c f g . yaml
network :
v e r s i o n : 2
r e n d e r e r : networkd
e t h e r n e t s :
e n p 0 s 3 1 f 6 :
dhcp4 : no
b r i d g e s :
br0 :
i n t e r f a c e s : [ e n p 0 s 3 1 f 6 ]
dhcp4 : no
a d d r e s s e s : [ 1 0 . 0 . 1 . 1 0 0 / 2 4 ]
gateway4 : 1 0 . 0 . 1 . 1
n a m e s e r v e r s :
a d d r e s s e s : [ 1 0 . 0 . 1 . 1 ]
Static IP addressing is highly suggested. DHCP addressing can also work, but you will still have to encode
a static address in the OpenVPN configuration file.
The next step on the server is to configure the ethernet device for promiscuous mode on boot. To do this,
ensure the networkd-dispatcher package is installed and create the following configuration script.
sudo apt update
sudo apt i n s t a l l networkd−d i s p a t c h e r
sudo touch / u s r / l i b / networkd−d i s p a t c h e r / dormant . d/ p r o m i s c _ b r i d g e
sudo chmod +x / u s r / l i b / networkd−d i s p a t c h e r / dormant . d/ p r o m i s c _ b r i d g e
Then add the following contents.
#!/ b i n / sh
s e t −e
i f [ ”$IFACE” = br0 ] ; then
# no networkd−d i s p a t c h e r e v e n t f o r ’ c a r r i e r ’ on t h e p h y s i c a l i n t e r f a c e
i p l i n k s e t e n p 0 s 3 1 f 6 up pro mi s c on
f i
Prepare server config for bridging
Edit /etc/openvpn/server.conf to use tap rather than tun and set
the server to use the server-bridge directive:
; dev tun
dev tap
; s e r v e r 1 0 . 8 . 0 . 0 2 5 5 . 2 5 5 . 2 5 5 . 0
s e r v e r −b r i d g e 1 0 . 0 . 0 . 4 2 5 5 . 2 5 5 . 2 5 5 . 0 1 0 . 0 . 0 . 1 2 8 1 0 . 0 . 0 . 2 5 4
After configuring the server, restart openvpn by entering:
sudo s y s t e m c t l r e s t a r t openvpn@myserver
221
Do'stlaringiz bilan baham: |