If your network configuration is controlled by a DHCP server, perform this task to configure a dynamic IP address bridge.
user @ubuntu:~$ cat /etc/network/interfaces # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto ens3 iface ens3 inet dhcp
user@ubuntu:~$ ifconfig -a
user@ubuntu:~$ ping example.com
bridge-utils
, using the following commands:
user@ubuntu:~$ sudo apt-get update user@ubuntu:~$ sudo apt-get install bridge-utils
user@ubuntu:~$ sudo vi /etc/network/interface
br0
bridge and enslave the primary network interface (ens
in the following example) under
br0
.
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # The primary network interface # We commented out the following two lines: #auto ens3 #iface ens3 inet dhcp # We added the following definition of br0: auto br0 iface br0 inet dhcp bridge_ports ens3 bridge_stp off bridge_fd 0 bridge_maxwait 0
user@ubuntu:~$ sudo reboot
user@ubuntu:~$ ifconfig -a br0 Link encap:Ethernet HWaddr 52:55:00:d1:55:01 inet addr:10.0.0.110 Bcast:10.0.0.255 Mask:255.255.255.0 inet6 addr: 2601:644:8780:2e56:e99d:2411:3c93:b7e6/64 Scope:Global inet6 addr: 2601:644:8780:2e56:5055:ff:fed1:5501/64 Scope:Global inet6 addr: fe80::5055:ff:fed1:5501/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:142 errors:0 dropped:0 overruns:0 frame:0 TX packets:93 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:18815 (18.8 KB) TX bytes:13887 (13.8 KB) ens3 Link encap:Ethernet HWaddr 52:55:00:d1:55:01 inet6 addr: fe80::5055:ff:fed1:5501/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:142 errors:0 dropped:0 overruns:0 frame:0 TX packets:103 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:20803 (20.8 KB) TX bytes:14793 (14.7 KB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:80 errors:0 dropped:0 overruns:0 frame:0 TX packets:80 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1 RX bytes:5920 (5.9 KB) TX bytes:5920 (5.9 KB)