ifconfig
ifconfig
修改网卡的配置文件,缺省选项和参数是查看激活状态的网卡信息
$ ifconfig
eth0 Link encap:Ethernet HWaddr b8:88:e3:e9:1f:2d
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:20102 errors:0 dropped:0 overruns:0 frame:0
TX packets:20102 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1897763 (1.8 MB) TX bytes:1897763 (1.8 MB)
wlan0 Link encap:Ethernet HWaddr e0:06:e6:cd:f8:cf
inet addr:192.168.1.111 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::e206:e6ff:fecd:f8cf/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:11539 errors:0 dropped:3 overruns:0 frame:0
TX packets:7005 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3352856 (3.3 MB) TX bytes:891096 (891.0 KB)
说明:
eth0
, wlan0
#网卡名
lo
主机环回地址
Link encap
#连接类型
HWaddr
#HardWareaddress,即MAC地址
inet addr
#ip地址
Bcast
#广播地址
Mask
#子网掩码
命令格式$ifconfig [网卡名] [选项] [参数]
add [地址]
#设置ip地址
del [地址]
#删除ip地址
up
#启动网络设备
down
#关闭网络设备
hw [设备类型] [硬件地址]
# 设置网络设备的类型与硬件地址
irq[IRQ地址]
# 设置网络设备的IRQ
netmask [子网掩码]
# 设置子网掩码
broadcast [广播地址]
# 设置广播地址