How to configure Virtual Network interface in RHEL7

Latest response

How to configure virtual network interface on Redhat 7 Linux

ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:50:56:9d:0f:80 brd ff:ff:ff:ff:ff:ff
inet 10.162.19.100/24 brd 10.162.19.255 scope global ens192
valid_lft forever preferred_lft forever
inet 10.162.19.101/24 brd 10.162.19.255 scope global secondary ens192:0
valid_lft forever preferred_lft forever

ping -c 1 10.162.19.100
PING 10.162.19.100 (10.162.19.226) 56(84) bytes of data.
64 bytes from 10.162.19.100: icmp_seq=1 ttl=64 time=0.052 ms

--- 10.162.19.100 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.052/0.052/0.052/0.000 ms

ping -c 1 10.162.19.101 -> I cannot ping the secondary IP
PING 10.162.19.101 (10.162.19.101) 56(84) bytes of data.
From 10.162.19.101 icmp_seq=1 Destination Port Unreachable

--- 10.162.19.101 ping statistics ---
1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms

Responses

Hello Paven Yanamadala,

In the /etc/sysconfig/network-scripts/ifcfg-ens192 file, make an additional entry of the 2 lines in the block below

Note the 2 below with "IPADDR2"
IPADDR2=10.162.19.101
PREFIX2=24

(I suspect or am guessing your network prefix is 24)

Do a systemctl network restart command

Now I suspect you just want a second ip address hanging off of the same interface, is that correct? If it isn't let us know, and disregard the above.

Regards,

RJ

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.