0

I am starting a sub-interface off of my existing eth0, and its supposed to be an instant thing, so I'm trying to avoid using a config file. When I issue:

ifconfig eth0:1 192.168.0.2 up

The interface comes up, and works, but my DNS resolution is lost, and I can't ping anything even say www.google.com, yet I could before the interface was brought up. The configuration for the initial interface is:

[root@server-1 network-scripts]# cat ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="static"
HWADDR="00:50:56:AF:0C:06"
IPADDR="192.168.0.1"
IPV6INIT="yes"
NETMASK="255.255.255.0"
ONBOOT="yes"
TYPE="Ethernet"
DNS1="192.168.2.10"
DNS2="192.168.3.10"

Am I not able to resolve DNS names after I start the sub-interface because they're on the same network?

This is the output of ip addr show

$ ip addr list

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:50:56:97:0c:06 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.1/24 brd 10.162.111.255 scope global eth0
    inet 192.168.2.1/30 brd 192.168.2.3 scope global eth0:2
    inet 192.168.2.5/30 brd 192.168.2.7 scope global eth0:3
    inet6 fe80::250:56ff:fe97:c06/64 scope link
       valid_lft forever preferred_lft forever
FilBot3
  • 234

1 Answers1

1

Turns out, in relation to this post, the answer I got that helped fix that issue, also fixed this issue. Instead of just issuing:

ifconfig eth0:1 192.168.0.2 up

I issued the command with a netmask at the end:

ifconfig eth0:1 192.168.0.2 netmask 255.255.255.0 up

and it worked. I can ping any DNS name, traceroute and all that jazz.

FilBot3
  • 234