1、作用
ifconfig命令用于显示或设置网络装备。
2、命令使用格式
2.1 显示体系的网络装备信息
ifconfig
2.2 设置网络装备
ifconfig <网络装备名> [options]
- 网络装备名:就是ifconfig显示的各个网络装备开头的第一个字段,如eth0、eth1等。
- options:参数(可选)
3、常用参数说明
- up:启动指定的网络装备。
- down:关闭指定的网络装备。
- netmask <子网掩码>:设置子网掩码。
- broadcast <广播地址>:设置广播地址。
- IP地址:指定网络装备的IP地址。
4、示例
4.1 显示体系的网络装备信息
- # ifconfig
- eth0 Link encap:Ethernet HWaddr 00:50:56:0A:0B:0C
- inet addr:192.168.0.3 Bcast:192.168.0.255 Mask:255.255.255.0
- inet6 addr: fe80::250:56ff:fe0a:b0c/64 Scope:Link
- UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
- RX packets:172220 errors:0 dropped:0 overruns:0 frame:0
- TX packets:132379 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:1000
- RX bytes:87101880 (83.0 MiB) TX bytes:41576123 (39.6 MiB)
- Interrupt:185 Base address:0x2024
- 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:16436 Metric:1
- RX packets:2022 errors:0 dropped:0 overruns:0 frame:0
- TX packets:2022 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:0
- RX bytes:2459063 (2.3 MiB) TX bytes:2459063 (2.3 MiB)
复制代码 4.2 设置网络装备
- //给eth0网卡配置IP地址
- # ifconfig eth0 192.168.1.56
- // 给eth0网卡配置IP地址,并加上子掩码
- # ifconfig eth0 192.168.1.56 netmask 255.255.255.0
- // 给eth0网卡配置IP地址,加上子掩码,加上个广播地址
- # ifconfig eth0 192.168.1.56 netmask 255.255.255.0 broadcast 192.168.1.255
- // 关闭eth0网卡
- # ifconfig eth0 down
- // 启功eth0网卡
- # ifconfig eth0 up
复制代码 免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |