Contents
查看网络信息
查看ip地址
| 
					 1 2  | 
						ifconfig  | 
					
显示mac地址
| 
					 1 2  | 
						sudo lshw -c network | grep serial  | 
					
打开和关闭设备
打开和关闭指定设备
- 
打开指定设备
12sudo ifconfig eth0 down - 
关闭指定设备
12sudo ifconfig eth0 up 
重启网络服务
| 
					 1 2  | 
						/etc/init.d/networking restart  | 
					
修改mac地址
| 
					 1 2  | 
						ifconfig eth0 hw ether XX:XX:XX:XX:XX:XX  | 
					
动态获取ip(临时)
获取
| 
					 1 2  | 
						sudo dhclient eth0  | 
					
断开
| 
					 1 2  | 
						sudo dhclient -r eth0  | 
					
配置ip(永久)
- 
打开网络配置文件
12vi /etc/network/interfaces - 
文件默认的内容如下:
123auto loiface lo inet loopback - 
动态获取的配置方法:
123auto eth0iface eth0 inet dhcp - 
静态分配的配置方法:
123456auto eth0iface eth0 inet staticaddress 192.168.0.1netmask 255.255.255.0gateway 192.168.0.1 
连接宽带
配置 pppoe
| 
					 1 2  | 
						$ sudo pppoeconf  | 
					
联网
| 
					 1 2  | 
						$ sudo pon dsl-provider  | 
					
断网
| 
					 1 2  | 
						$ sudo poff  | 
					
查看日志
| 
					 1 2  | 
						$ plog  | 
					
查看接口信息
| 
					 1 2  | 
						$ ifconfig ppp0  | 
					
查看端口是否开放
| 
					 1 2  | 
						netstat -antp|grep 8000  |