2

I'm trying to add a virtual interface, and following is the current configuration:

$ less /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
        post-up iptables-restore < /etc/iptables.up.rules

auto eth0:0
allow-hotplug eth0:0
iface eth0:0 inet manual

$ less /etc/NetworkManager/NetworkManager.conf
plugins=ifupdown,keyfile,ofono
dns=dnsmasq

[ifupdown]
managed=false

I've tried both true and false on managed, but eth0:0 still doesn't show on ifconfig:

$ ifconfig 
eth0      Link encap:Ethernet  HWaddr 00:1a:4b:62:f8:f4  
          UP BROADCAST MULTICAST  MTU:1500  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:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:22 Memory:e4600000-e4620000 

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:1251 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1251 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:121285 (121.2 KB)  TX bytes:121285 (121.2 KB)

wlan0     Link encap:Ethernet  HWaddr 00:1b:77:bc:16:d5  
          inet addr:192.168.1.3  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::21b:77ff:febc:16d5/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3382 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3048 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1593844 (1.5 MB)  TX bytes:511234 (511.2 KB)

As you can see, I've a wlan0 interface, as such I'd prefer if NM is still working besides my manual network configuration instead of straight-off removal.

Oxwivi
  • 17,849

1 Answers1

1

Ok, if you have one nic you can add virtual interfaces on this way

auto eth0
iface eth0 inet static
   address 192.168.1.57
   netmask 255.255.255.0
   gateway 192.168.1.1
   up ip addr add 192.168.0.57/24 dev eth0 label eth0:1
   down ip addr del 192.168.0.57/24 dev eth0 label eth0:1

I use 192.168.1.0/24 net range for eth0 and 192.168.0.0/24 for eht0:1. Change based on your need.

You must edit /etc/NetworkManager/NetworkManager.conf

sudo nano /etc/NetworkManager/NetworkManager.conf

This will open the NetworkManager.conf file in our text editor.

Now change:

managed=false

to

managed=true

After changes reload network service

sudo service networking restart

Or if this did not work, try

sudo ifdown eth0 && sudo ifup eth0

Edit 1

tray to add only

iface eth0:0 inet dhcp

in /etc/network/interfaces

2707974
  • 10,553
  • 6
  • 33
  • 45