1.在虛擬機(jī)下面設(shè)置網(wǎng)絡(luò)適配器為橋接模式(自動(dòng))
在編輯--->虛擬網(wǎng)絡(luò)編輯器--->橋接模式.
2.在終端配置ip地址.
手動(dòng)配置ip,gateway和dns
longhtml@ubuntu:~$sudo nano /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.251
netmask 255.255.255.0
gateway 192.168.1.254
接下來(lái)添加DNS
longhtml@ubuntu:~$cat /etc/resolv.conf
longhtml@ubuntu:~$sudo nano /etc/resolv.conf
nameserver 202.96.128.188????//深圳電信
nameserver 202.96.134.133
nameserver 192.168.1.254
longhtml@ubuntu:~$sudo /etc/init.d/networking restart
或者
longhtml@ubuntu:~$sudo service networking restart
如果配置失敗,可以使用手工配置方法:
longhtml@ubuntu:~$sudo ifconfig eth0 192.168.1.251 netmask 255.255.255.0 up
longhtml@ubuntu:~$sudo route add default gw 192.168.1.254 eth0