I have a question about Network Interfaces in LXC container: In my container,I have by default these interfaces:
ubuntu@u5:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:16:3e:b7:de:91
inet addr:10.0.3.138 Bcast:10.0.3.255 Mask:255.255.255.0
inet6 addr: fe80::216:3eff:feb7:de91/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:56 errors:0 dropped:0 overruns:0 frame:0
TX packets:40 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:7230 (7.2 KB) TX bytes:3500 (3.5 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:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
I'd like to add this new interface:
auto eth1
iface eth1 inet static
address 192.168.1.3
netmask 255.255.255.0
network 192.168.1.1
broadcast 192.168.1.255
So,I have modified this file: /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
auto eth1
iface eth1 inet static
address 192.168.1.3
netmask 255.255.255.0
network 192.168.1.1
broadcast 192.168.1.255
I have done reboot but it didn't work ! when I use ifconfig, I cant' find the new interface:
ubuntu@u5:/etc/network$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:16:3e:b7:de:91
inet addr:10.0.3.138 Bcast:10.0.3.255 Mask:255.255.255.0
inet6 addr: fe80::216:3eff:feb7:de91/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:57 errors:0 dropped:0 overruns:0 frame:0
TX packets:40 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:7337 (7.3 KB) TX bytes:3500 (3.5 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:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Have you an idea please ?
/etc/network/interfaces
doesn't add new virtual interfaces to LXC guests. – Pavel Šimerda Dec 26 '14 at 18:45lxc config device add
doesn't add it to/etc/network/interfaces
in the container. However, inside the container,ip address
does list the additional device except it has no IP address. – Derek Mahar Jun 01 '18 at 21:17