Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have to simulate unplugged network cable for testing issue to all applications we are developing in my company .
I have about 6 virtual machines Cent-OS on a virtual box .
from a php web page , I have to choose a server and stop its network and then start it again . of course I'm using ssh for remote connection to other servers .
and I if I stopped the eth0 (main network) on a server . I won't be able to reach it again with ssh . so I had to find another way to perform this .
I made another network connection (Host-only) between servers via virtualbox with the help of this tutorial , then I logged into one of the servers to configure IP for this new network with these two commands :

 sudo ifconfig eth1 up 


sudo ifconfig eth1 inet broadcast netmask up   

but when I'm trying to ssh this via php :

exec('ssh root@ 2>&1; ',$output);

I get this output :

ssh: connect to host port 22: No route to host

I don't know what I have missed ?

Edit : This is what I get when I run route

$ route -n                                                                                                        
Kernel IP routing table                                                                                                               
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface                                                   U     0      0        0 eth1                                                    U     0      0        0 eth0                                                      U     1002   0        0 eth0                                                          UG    0      0        0 eth0       
share|improve this question
Are you sure you typed it correctly, you have a comma in your IP address instead of a period. – David Houde Apr 11 '13 at 8:13
I've edited my question . – Nancy Smith Apr 11 '13 at 8:25
The question changes, from ping local IP to ssh to remote IP. Diagnostic steps: [from host] ping OK? ping OK? ping (default route) OK? ping from other host. Also, what is the IP of eth0? There may be conflict in IP, netmask, or default gateway. – David Houde Apr 11 '13 at 8:29
well , sorry for this conflict :$ . I tried your first and second ping and they're working correctly . yet last one is giving me $ ping PING ( 56(84) bytes of data. From icmp_seq=2 Destination Host Unreachable – Nancy Smith Apr 11 '13 at 8:34
ip of eth0 is : . this is the first time I deal with network connections . forgive my silly mistakes . – Nancy Smith Apr 11 '13 at 8:35

here's the answer : on CentOS1 :

sudo ifconfig eth1 netmask up

sudo touch /etc/sysconfig/network-scripts/ifcfg-eth1 

 sudo vi /etc/sysconfig/network-scripts/ifcfg-eth1  


sudo ifup eth1

on CentOS1 who ssh to this server:

sudo -u apache ssh root@"pwd"

then apache can ssh to and you can do whatever you want :)

 $ip_eth1= '';
 exec('ssh -p '.$port.' root@'.$ip_eth1.' "ip link set dev eth0 up";');
 exec('ssh -p '.$port.' root@'.$ip_eth1.' "ip link set dev eth0 down";');
share|improve this answer

Your Answer


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.