1.网卡设置
命令
ifconfig eth0 192.168.0.100 broadcast 192.168.0.1 netmask 255.255.255.0
ifconfig eth0 down
ifconfig eth0 up
debian,unbuntu下的设置文件/etc/network/interfaces
fedora平台下是/etc/sysconfig/network-scripts/ifcfg-eth0
2./etc/resolv.conf
该文件记录了dns的ip地址,可以有多个,如下所示:
yao@wuyao:~$ cat /etc/resolv.conf
nameserver 202.96.128.166
nameserver 202.96.128.86
nameserver 202.96.133.134
nameserver 192.168.198.22
nameserver 202.96.128.143
nameserver 202.96.128.132
nameserver 202.96.128.133
nameserver 61.144.56.101
nameserver 61.144.56.100
3./etc/hostname
该文件记录主机名
yao@wuyao:~$ cat /etc/hostname
wuyao
4./etc/hosts
hosts可以绑定一些IP,如下所示:
yao@wuyao:~$ cat /etc/hosts
127.0.0.1 localhost
192.168.0.111 wuyao
192.168.0.100 twomoon
192.168.0.1 gateway
220.181.27.48 baidu
64.233.189.104 google
203.208.37.104 g
220.181.28.51 163
这样在ping等命令的时就更简单了:
yao@wuyao:~$ ping gateway
PING gateway (192.168.0.1) 56(84) bytes of data.
64 bytes from gateway (192.168.0.1): icmp_seq=1 ttl=255 time=1.16 ms
64 bytes from gateway (192.168.0.1): icmp_seq=2 ttl=255 time=1.18 ms