网络管理
Table of Contents
1 网络管理
1.1 查看当前IP地址
ifconfig eth0 |awk '/inet/ {split($2,x,":");print x[2]}'
1.2 查看当前外网的IP地址
w3m -no-cookie -dump www.ip138.com/ip2city.asp|grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' w3m -no-cookie -dump ip.loveroot.com|grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' curl ifconfig.me
1.3 察看当前网卡的物理地址
ifconfig eth0 | head -1 | awk '{print $5}'
1.4 修改网卡MAC地址
sudo ifconfig eth0 down #关闭网卡 sudo ifconfig eth0 hw ether 00:AA:BB:CC:DD:EE #然后改地址 sudo ifconfig eth0 up #然后启动网卡
永久改地址方法
sudo gedit /etc/network/interfaces
在 iface eth0 inet static 后面添加一行:
pre-up ifconfig eth0 hw ether 01:01:01:01:01:01
配置文件应该像如下
iface eth0 inet static pre-up ifconfig eth0 hw ether 01:01:01:01:01:01 address 192.168.1.10 netmask 255.255.255.0 gateway 192.168.1.1
最后是 logout 或者reboot
1.5 查看网络的当前流量
#安装 ethstatus 软件 sudo apt-get install ethstatus #查看 ADSL 的速度 sudo ethstatus -i ppp0 #查看 网卡 的速度 sudo ethstatus -i eth0 #或安装 bwm-ng sudo apt-get install bwm-ng #查看当前网络流量 bwm-ng
2 其它技巧
2.1 查看域名的注册备案情况
whois baidu.cn