====== Ubuntu - Networking - Configuration - Virtual Network Interfaces - Configure Temporary Virtual Network Interface ======
===== Create Temporary Virtual Network Interface =====
ifconfig eth0:0 192.168.1.123
**NOTE:** This creates a new virtual network interface based on original **eth0** physical interface.
The only most important condition for creating the virtual network interface is the physical network interface, as in our case eth0 must exists.
----
===== Check existing interface =====
ifconfig eth0
returns:
eth0 Link encap:Ethernet HWaddr 3c:97:0e:02:98:c8
inet addr:192.168.1.69 Bcast:192.168.1.255
Mask:255.255.255.0
----
===== Ping the existing interface =====
ping 192.168.1.69
returns:
PING 192.168.1.69 (192.168.1.69) 56(84) bytes of data.
64 bytes from 192.168.1.69: icmp_seq=1 ttl=64 time=0.024 ms
64 bytes from 192.168.1.69: icmp_seq=2 ttl=64 time=0.030 ms
64 bytes from 192.168.1.69: icmp_seq=3 ttl=64 time=0.024 ms
64 bytes from 192.168.1.69: icmp_seq=4 ttl=64 time=0.026 ms
64 bytes from 192.168.1.69: icmp_seq=5 ttl=64 time=0.021 ms
--- 192.168.1.69 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4090ms
rtt min/avg/max/mdev = 0.021/0.025/0.030/0.003 ms
----
===== Configure a new virtual interface based on eth0 =====
ifconfig eth0:0
returns:
eth0:0 Link encap:Ethernet HWaddr 3c:97:0e:02:98:c8
UP BROADCAST MULTICAST MTU:1500 Metric:1
Interrupt:20 Memory:f1600000-f1620000
----
===== Assign an IP Address to the virtual interface =====
ifconfig eth0:0 192.168.1.123
----
===== Check the virtual interface =====
ifconfig eth0:0
returns:
eth0:0 Link encap:Ethernet HWaddr 3c:97:0e:02:98:c8
inet addr:192.168.1.123 Bcast:192.255.255.255 Mask:255.0.0.0
----
===== Ping the virtual interface =====
ping 192.168.1.123
returns:
PING 192.168.1.123 (192.168.1.123) 56(84) bytes of data.
64 bytes from 192.168.1.123: icmp_req=1 ttl=64 time=0.060 ms
64 bytes from 192.168.1.123: icmp_req=2 ttl=64 time=0.057 ms
----