0

In my current CentOS ifconfig, I have eth0 and the range of virtual interfaces eth0:0 - eth0:3 each taking up a unique address in the subnet 69.xx.yy.194/29 (gateway = .193, broadcast = .199)

Now I only get one shot at this because I access the server via remote terminal, so I thought I'd ask here to double check what I'm about to do.

I'm guessing if I perform ifdown eth0, it will take everything, including the interfaces down. What I would like is to be able to take down any one of my 5 services running on the machine by plugging them each into their own virtual interface (note, I only have 4 interfaces right now)

Therefore, is it possible to not have an IP address assigned to eth0, and rather put it on eth0:0 so I end up with 5 interfaces each with a separate address?

(Will this have unexpected side-effects for my PuTTY connection?)

1

You're correct that taking down eth0 will take down all cirtual interfaces based on eth0.

Instead of taking the interface down, you could reconfigure it with the address 0.0.0.0 - this will keep the interface up but without an IP address. I just verified that the following sequence worked perfectly:

The server originally has the address 172.17.8.10 on eth0, default gateway is 172.17.8.1

draal:~ # ifconfig eth0:0 172.17.8.11
draal:~ # ifconfig eth0 0.0.0.0
draal:~ # ping 172.17.8.1                                    
PING 172.17.8.1 (172.17.8.1) 56(84) bytes of data.           
64 bytes from 172.17.8.1: icmp_seq=1 ttl=255 time=0.119 ms   
64 bytes from 172.17.8.1: icmp_seq=2 ttl=255 time=0.244 ms   
^C                                                           
--- 172.17.8.1 ping statistics ---                           
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.119/0.181/0.244/0.063 ms            
draal:~ # ifconfig -a
eth0      Link encap:Ethernet  HWaddr 08:00:27:8C:98:44  
          inet6 addr: fe80::a00:27ff:fe8c:9844/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:11 errors:0 dropped:0 overruns:0 frame:0
          TX packets:24 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000                         
          RX bytes:1002 (1002.0 b)  TX bytes:1940 (1.8 Kb)     

eth0:0    Link encap:Ethernet  HWaddr 08:00:27:8C:98:44  
          inet addr:172.17.8.11  Bcast:172.17.255.255  Mask:255.255.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           

When you're doing this, it's highly likely that your SSH connection will be interrupted. I would start by SSH:ing to one of the virtual interfaces; as long as you don't do ifcfg eth0 down, that session should not be interrupted.

I would also advice you to setup an at job or cron job that resets all interfaces to their previous state after 5 minutes. If your new setup works, you can cancel the at job, but if it doesn't, you'll be able to get back in after a few minutes.

3
  • This doesn't appear to work for me. What is your ifconfig-eth0 file like? – Chris Watts Nov 9 '13 at 13:30
  • How does it not work? What happens? – Jenny D Nov 11 '13 at 9:52
  • eth0 is not brought back online if its IP address is 0.0.0.0 I can't really provide much more than this as it requires me to contact the datacenter to get them to attach a KVM – Chris Watts Nov 12 '13 at 22:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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