0

I am trying to get a VM accessible to other computers that are on the same network as enp3s0 which is my ethernet interface.

the idea is to create a bridge for it, so my /etc/network/interfaces looks like this:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto enp3s0
iface enp3s0 inet static
address 192.168.1.111
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.254
dns-nameservers 192.168.1.254 8.8.8.8

auto brx
iface brx inet static
  address 192.168.1.1
  network 192.168.1.0
  netmask 255.255.255.0
  broadcast 192.168.1.255
  bridge_ports enp3s0

I lose access to the host machine, once I save that file and reload the networking service using: service networking restart.

I have access to the host machine using ssh, and it's painful to debug.

here is the result of ipt addr:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether d8:cb:8a:7e:b0:0e brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.111/24 brd 192.168.1.255 scope global enp3s0
       valid_lft forever preferred_lft forever
    inet6 fe80::dacb:8aff:fe7e:b00e/64 scope link 
       valid_lft forever preferred_lft forever
3: bond0: <BROADCAST,MULTICAST,MASTER> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether de:d1:a5:18:d7:9e brd ff:ff:ff:ff:ff:ff
4: wlp4s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 60:57:18:ed:85:91 brd ff:ff:ff:ff:ff:ff
5: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 52:54:00:f1:90:4d brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
6: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000
    link/ether 52:54:00:f1:90:4d brd ff:ff:ff:ff:ff:ff
7: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 02:42:ca:92:29:7b brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 scope global docker0
       valid_lft forever preferred_lft forever
    inet6 fe80::42:caff:fe92:297b/64 scope link 
       valid_lft forever preferred_lft forever
8: br-55921dfae2b9: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 02:42:d2:f2:fd:9c brd ff:ff:ff:ff:ff:ff
    inet 172.27.0.1/16 scope global br-55921dfae2b9
       valid_lft forever preferred_lft forever
    inet6 fe80::42:d2ff:fef2:fd9c/64 scope link 
       valid_lft forever preferred_lft forever
9: br-6126f091366d: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 02:42:fd:89:f7:3e brd ff:ff:ff:ff:ff:ff
    inet 172.21.0.1/16 scope global br-6126f091366d
       valid_lft forever preferred_lft forever
    inet6 fe80::42:fdff:fe89:f73e/64 scope link 
       valid_lft forever preferred_lft forever
10: br-79007a99672c: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:f2:63:b4:a8 brd ff:ff:ff:ff:ff:ff
    inet 172.22.0.1/16 scope global br-79007a99672c
       valid_lft forever preferred_lft forever
11: br-90998da5c46b: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 02:42:40:01:23:c5 brd ff:ff:ff:ff:ff:ff
    inet 172.26.0.1/16 scope global br-90998da5c46b
       valid_lft forever preferred_lft forever
    inet6 fe80::42:40ff:fe01:23c5/64 scope link 
       valid_lft forever preferred_lft forever
12: br-d2baef82036f: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:d3:e8:9a:4d brd ff:ff:ff:ff:ff:ff
    inet 172.20.0.1/16 scope global br-d2baef82036f
       valid_lft forever preferred_lft forever
13: br-af8f996c43db: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:9f:b0:55:3d brd ff:ff:ff:ff:ff:ff
    inet 172.19.0.1/16 scope global br-af8f996c43db
       valid_lft forever preferred_lft forever
14: br-ca2d4fcf9238: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 02:42:90:b8:b5:b0 brd ff:ff:ff:ff:ff:ff
    inet 172.18.0.1/16 scope global br-ca2d4fcf9238
       valid_lft forever preferred_lft forever
    inet6 fe80::42:90ff:feb8:b5b0/64 scope link 
       valid_lft forever preferred_lft forever
15: br-e7fe7e040ae1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:48:58:a9:65 brd ff:ff:ff:ff:ff:ff
    inet 172.30.0.1/16 scope global br-e7fe7e040ae1
       valid_lft forever preferred_lft forever
17: vethbda138d@if16: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP group default 
    link/ether ea:b7:62:85:c5:37 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet6 fe80::e8b7:62ff:fe85:c537/64 scope link 
       valid_lft forever preferred_lft forever
19: veth4b4c337@if18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-6126f091366d state UP group default 
    link/ether f2:7a:3d:06:a2:cf brd ff:ff:ff:ff:ff:ff link-netnsid 2
    inet6 fe80::f07a:3dff:fe06:a2cf/64 scope link 
       valid_lft forever preferred_lft forever
21: vethd3629c0@if20: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-6126f091366d state UP group default 
    link/ether 7e:b6:9d:57:ff:cc brd ff:ff:ff:ff:ff:ff link-netnsid 6
    inet6 fe80::7cb6:9dff:fe57:ffcc/64 scope link 
       valid_lft forever preferred_lft forever
23: veth8c752ba@if22: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-90998da5c46b state UP group default 
    link/ether 4e:28:c4:34:84:6a brd ff:ff:ff:ff:ff:ff link-netnsid 5
    inet6 fe80::4c28:c4ff:fe34:846a/64 scope link 
       valid_lft forever preferred_lft forever
27: vethe4c8f38@if26: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-ca2d4fcf9238 state UP group default 
    link/ether f6:1f:d4:3c:5a:89 brd ff:ff:ff:ff:ff:ff link-netnsid 1
    inet6 fe80::f41f:d4ff:fe3c:5a89/64 scope link 
       valid_lft forever preferred_lft forever
29: veth1e8562f@if28: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-ca2d4fcf9238 state UP group default 
    link/ether ca:a9:2f:24:50:54 brd ff:ff:ff:ff:ff:ff link-netnsid 3
    inet6 fe80::c8a9:2fff:fe24:5054/64 scope link 
       valid_lft forever preferred_lft forever
33: veth243205b@if32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-55921dfae2b9 state UP group default 
    link/ether 52:55:7f:6e:71:ed brd ff:ff:ff:ff:ff:ff link-netnsid 7
    inet6 fe80::5055:7fff:fe6e:71ed/64 scope link 
       valid_lft forever preferred_lft forever
41: vethabea4e4@if40: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP group default 
    link/ether 46:1a:a7:f4:85:40 brd ff:ff:ff:ff:ff:ff link-netnsid 9
    inet6 fe80::441a:a7ff:fef4:8540/64 scope link 
       valid_lft forever preferred_lft forever
47: veth9e911aa@if46: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-55921dfae2b9 state UP group default 
    link/ether 16:c5:5a:58:21:2d brd ff:ff:ff:ff:ff:ff link-netnsid 10
    inet6 fe80::14c5:5aff:fe58:212d/64 scope link 
       valid_lft forever preferred_lft forever
  • Which network do you intend the bridge to be on? You have a completely different IP address and network configured for it as for your old enp3s0 configuration (which you don't seem to be using anymore). – Michael Hampton Nov 30 '17 at 20:40
  • Hey, I am trying to bridge enp3s0 – Amine Hakkou Nov 30 '17 at 21:13
  • Which IP address is correct, then? – Michael Hampton Nov 30 '17 at 21:17
  • in short i want the bridge to have the same ip range of enp3s0, so the correct ip is 192.168.1.0 – Amine Hakkou Nov 30 '17 at 21:22
  • When you add interface into bridge, you shouldn't configure any ip address and gateway on this interface, only bring up. All ip settings, those are configured on enp3s0 you should move into bridge interface. – Anton Danilov Nov 30 '17 at 21:41
2

You need to move all the physical device config to the bridge and set the phys dev to "manual". The bridge device becomes the network device you use instead of the phys dev.

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto enp3s0
iface enp3s0 inet manual

auto brx
iface brx inet static
address 192.168.1.111
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.254
dns-nameservers 192.168.1.254 8.8.8.8
bridge_ports enp3s0

I don't know what kind of VMs you're using but this is the setup I use for containers in LXD.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.