资源预览内容
第1页 / 共20页
第2页 / 共20页
第3页 / 共20页
第4页 / 共20页
第5页 / 共20页
第6页 / 共20页
第7页 / 共20页
第8页 / 共20页
第9页 / 共20页
第10页 / 共20页
亲,该文档总共20页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
第十章管理Linux网络,本章目标,了解Linux中网络设备的命名规则掌握修改网络参数的方法使用netconfig命令修改网络参数通过修改配置文件改变网络参数利用各类监视工具检查网络状态,本章内容,10.4网络状况监视工具,10.3与网络相关的配置文件,10.2使用网络配置工具,10.1常见网络设备,10.1常见网络设备,lo回环设备eth0系统内第一块以太网卡ppp0系统内第一个串行设备多数出现在使用ADSL拨入Internet时,10.2使用网络配置工具,10.2.1在命令行中配置网络参数10.2.2带有交互功能的netconfig命令,10.2.1在命令行中配置网络参数,ifconfigroutehostname,# ifconfig eth0eth0 Link encap:Ethernet HWaddr 00:0C:29:D9:2E:B9 inet addr:192.168.149.2 Bcast:192.168.149.255 Mask:255.255.255.0 inet6 addr: fe80:20c:29ff:fed9:2eb9/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:494 errors:0 dropped:0 overruns:0 frame:0 TX packets:479 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:48033 (46.9 KiB) TX bytes:86344 (84.3 KiB) Interrupt:169 Base address:0x2000,# ifconfig eth0 192.168.149.10 netmask 255.255.255.0# ifconfig eth0:1 10.0.0.1 netmask 255.255.255.0# ifconfig eth0 down # ifconfig eth0 up,10.2.1在命令行中配置网络参数,ifconfigroutehostname,# route -n 查看路由信息Kernel IP routing tableDestinationGatewayGenmaskFlagsMetricRefUseIface192.168.149.0*255.255.255.0U000eth010.0.0.0 *255.0.0.0U000eth011.0.0.0 *255.0.0.0U000eth0,# route add default gw 192.168.149.1# route add -net 10.0.0.0/24(要到达的网络) gw 192.168.149.1(通过本机的哪个接口出去)# route del -net 10.0.0.0/24,10.2.1在命令行中配置网络参数,ifconfigRouteUname a 查看系统内核hostname,# hostnamewnt.com.cn,# hostname -i# hostname linux-srv,# cat /etc/hosts127.0.0.1 linux-srv localhost localhost.localdomain,10.2.2带有交互功能的netconfig命令,配置信息被保存在下列文件中:/etc/sysconfig/network-scripts/ifcfg-ethN/etc/resolv.conf重新启动网络服务# service network restartShutting down interface eth0: OK Shutting down loopback interface: OK Bringing up loopback interface: OK Bringing up interface eth0: OK ,10.3与网络相关的配置文件,/etc/sysconfig/network-scripts/ifcfg-ethN/etc/sysconfig/network/etc/hosts/etc/host.conf/etc/resolv.conf,DEVICE=eth0ONBOOT=yesBOOTPROTO=staticIPADDR=192.168.149.2NETMASK=255.255.255.0GATEWAY=192.168.149.1,10.3与网络相关的配置文件,/etc/sysconfig/network-scripts/ifcfg-ethN/etc/sysconfig/network/etc/hosts/etc/host.conf/etc/resolv.conf,NETWORKING=yesHOSTNAME=localhost.localdomain,10.3与网络相关的配置文件,/etc/sysconfig/network-scripts/ifcfg-ethN/etc/sysconfig/network/etc/hosts/etc/host.conf/etc/resolv.conf,127.0.0.1localhost.localdomain localhost:1localhost6.localdomain6 localhost6,10.3与网络相关的配置文件,/etc/sysconfig/network-scripts/ifcfg-ethN/etc/sysconfig/network/etc/hosts/etc/host.conf/etc/resolv.conf,order hosts,bind,10.3与网络相关的配置文件,/etc/sysconfig/network-scripts/ifcfg-ethN/etc/sysconfig/network/etc/hosts/etc/host.conf/etc/resolv.conf,nameserver 192.168.1.1nameserver 192.168.1.2search wnt.com.cn,10.4网络状况监视工具,Netstate -nlutp 查看网络状况arpethtool/mii-toolpingtraceroute,# netstat -r# netstat -i# netstat -s,10.4网络状况监视工具,netstatearpethtool/mii-toolpingtraceroute,# arpAddressHWtype HWaddressFlags MaskIface192.168.149.1ether00:50:56:C0:00:01Ceth0,# arp -s 192.168.149.3 00:50:56:C0:00:03# arp -d 192.168.149.3,10.4网络状况监视工具,netstatearpethtool/mii-toolpingtraceroute,# ethtool eth0Settings for eth0: Supported ports: TP MII Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full Advertised auto-negotiation: Yes Speed: 100Mb/s Duplex: Half Port: MII PHYAD: 32 Transceiver: internal Auto-negotiation: on Supports Wake-on: pumbg Wake-on: d Current message level: 0x00000007 (7) Link detected: yes,# mii-tool -v eth0eth0: negotiated 100baseTx-HD, link ok product info: vendor 00:00:00, model 0 rev 0 basic mode: autonegotiation enabled basic status: autonegotiation complete, link ok capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD advertising: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD link partner: 100baseTx-HD 10baseT-HD,10.4网络状况监视工具,netstatearpethtool/mii-toolpingtraceroute,# ping -i 5 192.168.149.2PING 192.168.149.2 (192.168.149.2) 56(84) bytes of data.64 bytes from 192.168.149.2: icmp_seq=1 ttl=64 time=0.184 ms64 bytes from 192.168.149.2: icmp_seq=2 ttl=64 time=0.335 ms,10.4网络状况监视工具,netstatearpethtool/mii-toolpingtraceroute,# traceroute 219.146.0.130traceroute to 219.146.0.130 (219.146.0.130), 30 hops max, 40 byte packets 1 tu219129.ip.tsinghua.edu.cn (166.111.219.129) 12.691 ms 12.988 ms 15.285 ms 2 211.151.88.202 (211.151.88.202) 86.034 ms 91.394 ms 92.695 ms 3 211.151.88.250 (211.151.88.250) 95.192 ms 96.954 ms 99.326 ms 4 211.151.88.253 (211.151.88.253) 99.223 ms 99.122 ms 101.109 ms 5 211.151.224.157 (211.151.224.157) 100.945 ms 100.841 ms 105.726 ms 6 211.151.224.186 (211.151.224.186) 105.108 ms 75.619 ms 68.737 ms 7 222.173.18.233 (222.173.18.233) 83.569 ms 86.249 ms 102.849 ms 8 222.173.1.25 (222.173.1.25) 93.860 ms 94.982 ms 103.594 ms 9 219.146.20.206 (219.146.20.206) 95.657 ms 96.638 ms 98.101 ms10 219.146.15.38 (219.146.15.38) 108.165 ms 108.579 ms 110.390 ms11 219.146.15.41 (219.146.15.41) 103.060 ms 104.056 ms 105.397 ms12 219.146.0.254 (219.146.0.254) 61.586 ms 29.409 ms 83.508 ms13 219.146.0.254 (219.146.0.254) 83.043 ms 86.075 ms 87.057 ms,
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号