介绍几个查看,使用,配置,网卡信息经常用到的命令:
A:ifconfing可查看IP,MAC地址,子网掩码,加“-a”参数则更为详细
例:$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:1F:C6:C8:FD:2d
inet addr:192.168.2.166 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::21f:c6ff:fec8:fd26/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:314872865 errors:0 dropped:0 overruns:0 frame:0
TX packets:393067896 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2945725801 (2.7 GiB) TX bytes:395247405 (376.9 MiB)
Interrupt:233 Base address:0xe000
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:49099 errors:0 dropped:0 overruns:0 frame:0
TX packets:49099 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2965677 (2.8 MiB) TX bytes:2965677 (2.8 MiB)
B 查看配置文件
$ more /etc/sysconfig/network-scripts/ifcfg-eth0
# Realtek Semiconductor Co., Ltd. RTL8101E/RTL8102E PCI Express Fast Ethernet co
ntroller
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.2.255
HWADDR=00:1F:C6:C8:FD:2d
IPADDR=192.168.2.166
NETMASK=255.255.255.0
NETWORK=192.168.2.1
ONBOOT=yes
C 配置网卡信息
1.配置/etc/sysconfig/network-scripts/ifcfg-eth0
2.setup命令(图形化的配置界面很简单)
3.ifconfig eth0 192.168.2.166 netmask 255.255.255.0 up (即时生效)
ifconfig eth0 up
ifconfig eth0 down
D 启动网卡服务
$service network start restart (重启) stop(关闭)
$ /etc/init.d/network start restart (重启) stop(关闭)
E 配置dns
修改配置文件vi /etc/resolv.conf
NAMESERVER 202.102.152.3
NAMESERVER 202.102.134.68
F 查看网卡硬件信息
$dmesg |grep -i eth
r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
eth0: RTL8102e at 0xf887e000, 00:1f:c6:c8:fd:2D, XID 04a00000 IRQ 233
r8169: eth0: link up
r8169: eth0: link up
eth0: no IPv6 routers present
r8169: eth0: link down
r8169: eth0: link up
以上是几个简单常用命令,如果有误还请指出。。。。。