Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
share|improve this question
    
Look at the routing table, befote and after. My guess is that your neglegting to include a mask is trashing your routes. –  Zoredache Sep 12 '13 at 15:24
    
I might have just solved this issue as well as my other one, I'm testing some more, I will post my answer in a bit. –  Pred Sep 12 '13 at 16:07
1  
BTW, you really should avoid using ifconfig and start learning how to use ip instead. The equivalent command would be ip addr add 192.168.0.2/24 dev eth0. –  Zoredache Sep 12 '13 at 16:30
    
What's the added benefit of using that? –  Pred Sep 13 '13 at 13:41
    
I used the ip addr add 192.168.02/24 dev eth0 command, and now the ip address is not showing, nor can I use ifconfig eth0:1 192.168.0.2 netmask 255.255.255.0 up command. Tells me: SIOCGIFADDR: Cannot assign requested address SIOCSIFBROADCAST: Cannot assign requested address SIOCSIFFLAGS: Cannot assign requested address and then when i use the command you suggested with up it tells me its garbage. How do I remove the file now since RTNETLINK answers: File exists –  Pred Sep 13 '13 at 16:18

1 Answer 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.

share|improve this answer
    
However, now that I have the ability to ping FQDN names, I cannot access my website provided by the IP I am bringing up. –  Pred Sep 16 '13 at 16:05
    
Turns out that there were multiple machines on my network with that same IP, just no FQDN with them. Someone who is running my network is not properly maintaining it. –  Pred Sep 20 '13 at 13:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.