Ubuntu – VLAN on main interface (no subinterface)

17.04interfacenetwork-managernetworkingserver

I have Ubuntu 17.04. I see on ifconfig that I have eno1 (not eth0). I was created vlan, whose working (I can ping device from that vlan). But actually I see that computer is connected to two networks.

eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    inet 10.1.1.52  netmask 255.255.255.0  broadcast 10.1.1.255
    inet6 fe80::21fb:881b:982f:a314  prefixlen 64  scopeid 0x20<link>
    ether 34:17:eb:cd:2e:0d  txqueuelen 1000  (Ethernet)
    RX packets 13464458  bytes 1276532566 (1.2 GB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 14381729  bytes 996608618 (996.6 MB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    device interrupt 20  memory 0xf7c00000-f7c20000  

eno1.90: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    inet 10.66.64.10  netmask 255.255.252.0  broadcast 10.66.66.255
    inet6 fe80::3617:ebff:fecd:2e0d  prefixlen 64  scopeid 0x20<link>
    ether 34:17:eb:cd:2e:0d  txqueuelen 1000  (Ethernet)
    RX packets 1157363  bytes 48659026 (48.6 MB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 1375778  bytes 79131321 (79.1 MB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

I need to change this settings. PC should work ony on vlan90. I mean vlan 90 will serviced on eno1, not on subinterface eno1.90. Without connecting to "managment network".

Network 10.1.1.0/24 isn't tagged.
Network 10.66.64.0/22 is tagged.

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

auto eno1.90
iface eno1.90 inet static
    address 10.66.64.9
    netmask 255.255.252.0
    network 10.66.64.0
    broadcast 10.66.66.255
    mtu 1500
    vlan-raw-device eno1

I disable network manager:

● NetworkManager.service - Network Manager
   Loaded: loaded (/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Tue 2017-07-11 08:45:50 CEST; 52s ago
     Docs: man:NetworkManager(8)
 Main PID: 999 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/NetworkManager.service
           └─10450 /sbin/dhclient -d -q -sf /usr/lib/NetworkManager/nm-dhcp-helper -pf /var/run/dhcli

lip 11 07:22:42 user NetworkManager[999]: <info>  [1499750562.7541] dhcp4 (eno1):   lease ti
lip 11 07:22:42 user NetworkManager[999]: <info>  [1499750562.7541] dhcp4 (eno1):   nameserv
lip 11 07:22:42 user NetworkManager[999]: <info>  [1499750562.7542] dhcp4 (eno1):   nameserv
lip 11 07:22:42 user NetworkManager[999]: <info>  [1499750562.7542] dhcp4 (eno1):   domain n
lip 11 07:22:42 user NetworkManager[999]: <info>  [1499750562.7542] dhcp4 (eno1): state chan
lip 11 07:22:42 user dhclient[10450]: bound to 10.1.1.52 -- renewal in 14027 seconds.
lip 11 08:45:50 user systemd[1]: Stopping Network Manager...
lip 11 08:45:50 user NetworkManager[999]: <info>  [1499755550.2979] caught SIGTERM, shutting
lip 11 08:45:50 user NetworkManager[999]: <info>  [1499755550.2987] exiting (success)
lip 11 08:45:50 user systemd[1]: Stopped Network Manager.

I was add new configuration on interface:

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

auto eno1
#iface eno1 inet dhcp
iface eno1 inet manual
#       address 10.1.1.250
#       netmask 255.255.255.0
#       gateway 10.1.1.253
#       network 10.1.1.0
#       broadcast 10.1.1.255
#       mtu 1500

auto eno1.90
iface eno1.90 inet static
        address 10.66.64.9
        netmask 255.255.252.0
        gateway 10.1.1.1
        network 10.66.64.0
        broadcast 10.66.66.255
        mtu 1500
        vlan-raw-device eno1

But after restart NM nothing happened, so I disable it again. In next step I was down interface and then up it again. After this I see it looks start working, because I can't ping devices from 10.1.1.0/24 network. But when I use ifconfig I see the same info like in top.

Now I see that i have some problem with networking service, maybe this is reason of frozen IP address?

● networking.service - Raise network interfaces
   Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor prese
   Active: failed (Result: exit-code) since Fri 2017-07-14 16:45:41 CEST; 1min 5
     Docs: man:interfaces(5)
 Main PID: 15424 (code=exited, status=1/FAILURE)

lip 14 16:45:34 user systemd[1]: Starting Raise network interfaces...
lip 14 16:45:41 user ifup[15424]: Set name-type for VLAN subsystem. Sho
lip 14 16:45:41 user ifup[15424]: RTNETLINK answers: File exists
lip 14 16:45:41 user ifup[15424]: Failed to bring up eno1.90.
lip 14 16:45:41 user systemd[1]: networking.service: Main process exite
lip 14 16:45:41 user systemd[1]: Failed to start Raise network interfac
lip 14 16:45:41 user systemd[1]: networking.service: Unit entered faile
lip 14 16:45:41 user systemd[1]: networking.service: Failed with result

2017/07/17
I was just resolve first problem I think. I use firstly Method #2 from https://www.cyberciti.biz/tips/howto-configure-linux-virtual-local-area-network-vlan.html so I have necessary setting. I remove it, using

# ifconfig eno1.90 down
# vconfig rem eno1.90

After this I down the interface, then networking service restart (It's up without errors) then up interface. Now in /proc/net/vlan is created file eno1.90. So I think configuration is now correct. Maybe with main interface is the same, because when I set interface with static option:

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

auto eno1
#iface eno1 inet dhcp
#iface eno1 inet manual
iface eno1 inet static
       address 10.1.1.250
       netmask 255.255.255.0
       gateway 10.1.1.253
#       network 10.1.1.0
#       broadcast 10.1.1.255
#       mtu 1500

auto eno1.90
iface eno1.90 inet static
        address 10.66.64.9
        netmask 255.255.252.0
        gateway 10.1.1.1
        network 10.66.64.0
        broadcast 10.66.66.255
        mtu 1500
        vlan-raw-device eno1

ifconfig still show that I have IP 10.1.1.52, when it should have 10.1.1.250. What more, I can ping PC using this two adress (it respond for .52 and .250) 😀 But I don't know how fix it.

Best Answer

You can disable eno1. It is brought up by Network Manger.

You can fix it by disabling Network Manager or by adding

iface eno1 inet manual

to /etc/network/interfaces. NM will not deal with any interface declared in interfaces.

To aplly this setting run

sudo systemctl restart network-manager
Related Question