虛拟機下的LINUX為UBUNTU。
1. 配置虛拟機下IP位址和橋接的網卡在同一個網段,具有同一個網關、具有相同的DNS
2. 配置IP
# ifconfig eth0 10.58.21.159 netmask 255.255.255.0
# /etc/init.d/networking restart
# ifconfig
# ping 10.58.21.157
3:添加網關
# route add default gw 10.58.21.18
# /etc/init.d/networking restart
# ping 10.58.21.18 //OK
# ping www.baidu.com //FAIL
4. 添加DNS(
方式一:修改/etc/network/interfaces(永久)
方式二:/etc/resolv.conf(臨時)
添加 nameserver 218.2.135.X