I have a bridged connection on VirtualBox from os/x 10.8.5 host to Centos 5.8 client.
But I suspect this is more of a general issue than specific to the host and precise version of linux.
Shown below are the networking info from the VirtualBox and from within the guest
sshd is running on port 22:
[root@oracle-linux ~]# ps -ef | grep sshd | grep -v grep
root 3103 1 0 20:22 ? 00:00:00 /usr/sbin/sshd
root 14994 3103 0 21:23 ? 00:00:00 sshd: root@pts/1
Netstat:
[root@oracle-linux ~]# netstat -an | grep tcp | grep LIST
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:954 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:2207 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:2208 0.0.0.0:* LISTEN
tcp 0 0 :::22 :::* LISTEN
Firewall is disabled:
[root@oracle-linux init.d]# service iptables status
Firewall is stopped.
Here are ip addresses, GUEST (after change to BRIDGE): :
[root@oracle-linux ~]# ifconfig -a
eth0 Link encap:Ethernet HWaddr 08:00:27:B9:E5:79
inet addr:10.0.15.100 Bcast:10.0.15.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:feb9:e579/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:46 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:6754 (6.5 KiB)
eth1 Link encap:Ethernet HWaddr 08:00:27:B4:86:8A
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1064 errors:0 dropped:0 overruns:0 frame:0
TX packets:1064 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1799516 (1.7 MiB) TX bytes:1799516 (1.7 MiB)
HOST:
c1166313@ma2-gbip-lap105's password:
06:46:37/shared:7 $ifconfig -a
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
options=3<RXCSUM,TXCSUM>
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
inet 127.0.0.1 netmask 0xff000000
inet6 ::1 prefixlen 128
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether b8:f6:b1:15:dd:bf
inet6 fe80::baf6:b1ff:fe15:ddbf%en0 prefixlen 64 scopeid 0x4
inet 10.0.0.7 netmask 0xffffff00 broadcast 10.0.0.255
media: autoselect
status: active
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
ether 0a:f6:b1:15:dd:bf
media: autoselect
status: inactive
vboxnet0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 0a:00:27:00:00:00
inet 192.168.7.1 netmask 0xffffff00 broadcast 192.168.7.255
I can ssh to the guest from the guest:
root@oracle-linux ~]# ssh 10.0.3.15
The authenticity of host '10.0.3.15 (10.0.3.15)' can't be established.
RSA key fingerprint is ef:08:19:72:95:4d:e5:28:af:f3:6f:54:07:84:ba:04.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.0.3.15' (RSA) to the list of known hosts.
root@10.0.3.15's password:
Last login: Mon Oct 21 21:24:12 2013 from 10.0.15.100
But can NOT ssh from the host to the guest:
18:27:04/shared:11 $ssh root@10.0.3.15
ssh: connect to host 10.0.15.100 port 22: Operation timed out
lost connection
Here is bridged connection infO;
Adapter 2 is a NAT, shown below
In case NAT is causing any issues, i shut it down and restarted networking.
[root@oracle-linux ~]# /etc/init.d/network restart
Shutting down interface eth0: [ OK ]
Shutting down interface eth1:
Still No joy..
18:27:04/shared:11 $ssh root@10.0.3.15
ssh: connect to host 10.0.15.100 port 22: Operation timed out
lost connection
BTW: as part of troubleshooting I brought up a different Centos VM (version 6.2). This other VM is from a different vendor (cloudera) but I configured it also as Bridged adapter. The second VM works fine.
07:03:23/shared:12 $ping 10.0.0.9
PING 10.0.0.9 (10.0.0.9): 56 data bytes
64 bytes from 10.0.0.9: icmp_seq=0 ttl=64 time=0.350 ms
64 bytes from 10.0.0.9: icmp_seq=1 ttl=64 time=0.337 ms
64 bytes from 10.0.0.9: icmp_seq=2 ttl=64 time=0.339 ms
Best Answer
The issue was that /etc/network-scripts/ifcfg-eth0 had static IP address set:
The solution was to remove those and set dhcp:
Note: user CIA started to point the way here by mentioning the incorrect subnet for the guest.