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 192.168.1.101 up
also
sudo ifconfig eth1 inet 192.168.1.101 broadcast 192.168.1.255 netmask 255.255.255.0 up
but when I'm trying to ssh this via php :
exec('ssh root@192.168.1.101 2>&1; ',$output);
I get this output :
ssh: connect to host 192.168.1.101 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
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
0.0.0.0 192.168.0.204 0.0.0.0 UG 0 0 0 eth0
No comments:
Post a Comment