Preamble

Pay your attention, for this lab, we will use legacy “network.service” daemon.

If “NetworkManager.service” is running :

[root@fedora22 ~]# systemctl is-active NetworkManager.service
active

Stop it :

[root@fedora22 ~]# systemctl stop NetworkManager.service

And disable it :

[root@fedora22 ~]#

[root@fedora22 ~]# systemctl disable NetworkManager.service
Removed symlink /etc/systemd/system/multi-user.target.wants/NetworkManager.service.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.NetworkManager.service.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service.

Now, we can use “network.service” :

[root@fedora22 ~]# systemctl is-active network.service
active

Add a new networking interface

Here is my VMware network configuration :

fedora nic

Now, add a new network interface to your “fedora 22” virtual machine :

fedora nic1

 

 

 

 

 

 

fedora nic2

fedora nic3

 

 

 

 

 

 

 

 

 

 

fedora nic4

 

 

 

 

 

 

 

 

 

 

 

 

Then, finish :

fedora nic5

 

 

 

 

 

 

 

 

 

 

 

And confirm :

fedora nic6

Your second ethernet card has been dynamically created :

fedora nic7

 

 

 

 

 

 

 

 

 

 

 

 

 

Now, open a session to your “fedora 22” virtual machine, it’s so marvelous : your second NIC is here up & running !

[root@fedora22 ~]# ifconfig
eno16780032: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
 inet 192.168.1.200 netmask 255.255.255.0 broadcast 192.168.1.255
 inet6 fe80::20c:29ff:fe9e:e38d prefixlen 64 scopeid 0x20<link>
 ether 00:0c:29:9e:e3:8d txqueuelen 1000 (Ethernet)
 RX packets 561 bytes 79006 (77.1 KiB)
 RX errors 0 dropped 0 overruns 0 frame 0
 TX packets 343 bytes 31691 (30.9 KiB)
 TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eno33559296: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
 ether 00:0c:29:9e:e3:97 txqueuelen 1000 (Ethernet)
 RX packets 2 bytes 120 (120.0 B)
 RX errors 0 dropped 0 overruns 0 frame 0
 TX packets 0 bytes 0 (0.0 B)
 TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
 inet 127.0.0.1 netmask 255.0.0.0
 inet6 ::1 prefixlen 128 scopeid 0x10<host>
 loop txqueuelen 0 (Local Loopback)
 RX packets 4 bytes 340 (340.0 B)
 RX errors 0 dropped 0 overruns 0 frame 0
 TX packets 4 bytes 340 (340.0 B)
 TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

More details with “ip” command :

[root@fedora22 ~]# ip addr show dev eno33559296
3: eno33559296: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
   link/ether 00:0c:29:9e:e3:97 brd ff:ff:ff:ff:ff:ff

Is VLAN kernel module currently loaded ?

[root@fedora22 ~]# lsmod | grep 1q

No, so add it :

[root@fedora22 ~]# modprobe 8021q
[root@fedora22 ~]# lsmod | egrep "^8021q"
8021q                  32768  0

Create interface configuration file :

[root@fedora22 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eno33559296
DEVICE=eno33559296
TYPE="Ethernet"
BOOTPROTO="none"
ONBOOT="yes"

Create “VLAN 100” configuration file :

[root@fedora22 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eno33559296.100
DEVICE=eno33559296.100
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.2.200
NETMASK=255.255.255.0
USERCTL=no
NETWORK=192.168.2.0
VLAN=yes

And restart network :

[root@fedora22 ~]# systemctl restart network.service

To check this new VLAN tagged interface, send ICMP packet to another I.P. address in the same range, for example (here, this server is not connected) :

[root@fedora22 ~]# ping -c2 192.168.2.201
PING 192.168.2.201 (192.168.2.201) 56(84) bytes of data.
From 192.168.2.200 icmp_seq=1 Destination Host Unreachable
From 192.168.2.200 icmp_seq=2 Destination Host Unreachable
--- 192.168.2.201 ping statistics ---
2 packets transmitted, 0 received, +2 errors, 100% packet loss, time 999ms
pipe 2

You will see transmetted packets :

[root@fedora22 ~]# cat /proc/net/vlan/eno33559296.100
eno33559296.100 VID: 100 REORDER_HDR: 1 dev->priv_flags: 1
 total frames received 0
 total bytes received 0
 Broadcast/Multicast Rcvd 0

total frames transmitted 13 total bytes transmitted 858 Device: eno33559296 INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0 EGRESS priority mappings:

This configuration is persistent across reboot.

Remove this VLAN interface

Remove the configuration file :

[root@fedora22 ~]# rm /etc/sysconfig/network-scripts/ifcfg-eno33559296.100

Disable the VLAN network interface :

[root@fedora22 ~]# ip link set eno33559296.100 down

Remove this VLAN network interface :

[root@fedora22 ~]# ip link delete eno33559296.100

 

 

PDF24    Send article as PDF   

Leave a Reply

Your email address will not be published. Required fields are marked *


*