A question about virtual interface
by Jason.nix from LinuxQuestions.org on (#6D7PM)
Hello,
I created a virtual interface like the below:
Code:# touch /etc/network/interfaces.d/ifcfg-enp0s3:0
# nano /etc/network/interfaces.d/ifcfg-enp0s3:0
auto enp0s3:0
iface enp0s3:0 inet static
address 10.0.5.20
netmask 255.255.255.0Then:
Code:# systemctl restart networking
#
# ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.2.15 netmask 255.255.255.0 broadcast 10.0.2.255
inet6 fe80::a00:27ff:feed:b47c prefixlen 64 scopeid 0x20<link>
ether 08:00:27:ed:b4:7c txqueuelen 1000 (Ethernet)
RX packets 7624 bytes 2522366 (2.4 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 5147 bytes 869088 (848.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp0s3:0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.5.20 netmask 255.255.255.0 broadcast 10.0.5.255
ether 08:00:27:ed:b4:7c txqueuelen 1000 (Ethernet)
...But, why I can't use it for some common network tasks:
Code:# ping -I enp0s3 google.com
PING google.com (216.239.38.120) from 10.0.2.15 enp0s3: 56(84) bytes of data.
64 bytes from any-in-2678.1e100.net (216.239.38.120): icmp_seq=1 ttl=63 time=35.3 ms
64 bytes from any-in-2678.1e100.net (216.239.38.120): icmp_seq=2 ttl=63 time=71.7 ms
^C
--- google.com ping statistics ---
3 packets transmitted, 2 received, 33.3333% packet loss, time 2100ms
rtt min/avg/max/mdev = 35.292/53.511/71.730/18.219 ms
#
# ping -I enp0s3:0 google.com
ping: invalid source address: enp0s3:0
Thank you.
I created a virtual interface like the below:
Code:# touch /etc/network/interfaces.d/ifcfg-enp0s3:0
# nano /etc/network/interfaces.d/ifcfg-enp0s3:0
auto enp0s3:0
iface enp0s3:0 inet static
address 10.0.5.20
netmask 255.255.255.0Then:
Code:# systemctl restart networking
#
# ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.2.15 netmask 255.255.255.0 broadcast 10.0.2.255
inet6 fe80::a00:27ff:feed:b47c prefixlen 64 scopeid 0x20<link>
ether 08:00:27:ed:b4:7c txqueuelen 1000 (Ethernet)
RX packets 7624 bytes 2522366 (2.4 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 5147 bytes 869088 (848.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp0s3:0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.5.20 netmask 255.255.255.0 broadcast 10.0.5.255
ether 08:00:27:ed:b4:7c txqueuelen 1000 (Ethernet)
...But, why I can't use it for some common network tasks:
Code:# ping -I enp0s3 google.com
PING google.com (216.239.38.120) from 10.0.2.15 enp0s3: 56(84) bytes of data.
64 bytes from any-in-2678.1e100.net (216.239.38.120): icmp_seq=1 ttl=63 time=35.3 ms
64 bytes from any-in-2678.1e100.net (216.239.38.120): icmp_seq=2 ttl=63 time=71.7 ms
^C
--- google.com ping statistics ---
3 packets transmitted, 2 received, 33.3333% packet loss, time 2100ms
rtt min/avg/max/mdev = 35.292/53.511/71.730/18.219 ms
#
# ping -I enp0s3:0 google.com
ping: invalid source address: enp0s3:0
Thank you.