1. 程式人生 > >10.2-3 ifup&ifdown:激活與禁用網絡接口

10.2-3 ifup&ifdown:激活與禁用網絡接口

sysconfig 指定 ethernet ifd 操作 overruns bsp network enc

ifup:激活網絡接口

ifup 和 ifdown 命令用於激活指定的網絡接口。ifup命令其實是一個Shel腳本,有Shel基礎的讀者可以使用which命令來找到這個腳本並讀一讀。命令可讀取配置文件/etc/sysconfig/network和/etc/sysconfig/network-scripts/ifcfg-<configuration>對網絡接口進行相應的操作。

ifdown:禁用網絡接口

[[email protected] ~]# ifdown eth1
[[email protected] ~]# ifconfig 
eth0 Link encap:Ethernet HWaddr 
00:AA:BB:CC:DD:EE inet addr:10.0.0.100 Bcast:10.0.0.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe8c:6a04/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:16249 errors:0 dropped:0 overruns:0 frame:0 TX packets:7819 errors:0 dropped:0 overruns:0
carrier:0 collisions:0 txqueuelen:1000 RX bytes:20914267 (19.9 MiB) TX bytes:634620 (619.7 KiB) eth0:0 Link encap:Ethernet HWaddr 00:AA:BB:CC:DD:EE inet addr:10.0.0.101 Bcast:10.0.0.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 eth0:1 Link encap:Ethernet HWaddr 00
:AA:BB:CC:DD:EE inet addr:10.0.0.8 Bcast:10.0.0.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 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:6 errors:0 dropped:0 overruns:0 frame:0 TX packets:6 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:504 (504.0 b) TX bytes:504 (504.0 b)

10.2-3 ifup&ifdown:激活與禁用網絡接口