Linux启动网卡
ifconfig命令可以用于查看Linux活动网卡与IP地址、子网掩码或者mac地址等信息
[root@localhost ~]# ifconfig eth0 Link encap:Ethernet HWaddr 08:00:27:D4:71:2D inet addr:192.168.1.104 Bcast:255.255.255.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fed4:712d/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1693 errors:0 dropped:0 overruns:0 frame:0 TX packets:255 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:118346 (115.5 KiB) TX bytes:53987 (52.7 KiB) Interrupt:10 Base address:0xd020 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:7 errors:0 dropped:0 overruns:0 frame:0 TX packets:7 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:672 (672.0 b) TX bytes:672 (672.0 b)
eth0 是Linux主机的一块网卡,lo是本地回环
ifconfig eth0 up #可以用于启动网卡
ifconfig eth0 down #可以用于禁用网卡
ifconfig eth0 192.168.1.101 #可以给主机制定静态地址
如果要使用DHCP分配,可以使用dhclient命令
在终端直接输入dhclient即可:)