1.修改IP地址
ubuntu@ubuntu:~$ gedit /etc/network/interfaces
默認設置:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp
修改後配置:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.101.170
netmask 255.255.255.0
network 192.168.101.0
broadcast 192.168.1.255
gateway 192.168.101.1
2.修改DNS
ubuntu@ubuntu:~$ gedit /etc/resolv.conf
nameserver 202.96.69.38
domain domain
search domain
3.測試連接外網
ubuntu@ubuntu:~$ nslookup www.baidu.com
Server: 202.96.69.38
Address: 202.96.69.38#53
Non-authoritative answer:
www.baidu.com canonical name = www.a.shifen.com.
Name: www.a.shifen.com
Address: 61.135.169.105
Name: www.a.shifen.com
Address: 61.135.169.125
可以解析到域名和IP地址