22.6. 添​​​​​​​加​​​​​​​网​​​​​​​络​​​​​​​设​​​​​​​备​​​​​​​

内​​​​​​​核​​​​​​​版​​​​​​​本​​​​​​​从​​​​​​​ 2.4 移​​​​​​​植​​​​​​​到​​​​​​​ 2.6 之​​​​​​​后​​​​​​​,添​​​​​​​加​​​​​​​网​​​​​​​络​​​​​​​设​​​​​​​备​​​​​​​的​​​​​​​方​​​​​​​法​​​​​​​已​​​​​​​经​​​​​​​有​​​​​​​了​​​​​​​很​​​​​​​大​​​​​​​的​​​​​​​变​​​​​​​化​​​​​​​。​​​​​​​
  • proc 文​​​​​​​件​​​​​​​系​​​​​​​统​​​​​​​已​​​​​​​经​​​​​​​不​​​​​​​再​​​​​​​用​​​​​​​于​​​​​​​控​​​​​​​制​​​​​​​或​​​​​​​获​​​​​​​取​​​​​​​网​​​​​​​络​​​​​​​设​​​​​​​备​​​​​​​的​​​​​​​状​​​​​​​态​​​​​​​。​​​​​​​
  • 新​​​​​​​的​​​​​​​ sys 文​​​​​​​件​​​​​​​系​​​​​​​统​​​​​​​提​​​​​​​供​​​​​​​了​​​​​​​新​​​​​​​的​​​​​​​工​​​​​​​具​​​​​​​来​​​​​​​控​​​​​​​制​​​​​​​设​​​​​​​备​​​​​​​。​​​​​​​
  • /sys/class/net/interface_name/device now provides status on active devices.
    interface_name 是​​​​​​​象​​​​​​​ eth0 或​​​​​​​ ctc2 的​​​​​​​名​​​​​​​字​​​​​​​。​​​​​​​当​​​​​​​设​​​​​​​备​​​​​​​被​​​​​​​配​​​​​​​置​​​​​​​时​​​​​​​,设​​​​​​​备​​​​​​​驱​​​​​​​动​​​​​​​程​​​​​​​序​​​​​​​把​​​​​​​这​​​​​​​个​​​​​​​名​​​​​​​字​​​​​​​提​​​​​​​供​​​​​​​给​​​​​​​网​​​​​​​络​​​​​​​接​​​​​​​口​​​​​​​。​​​​​​​
  • /etc/chandev.conf 不​​​​​​​再​​​​​​​存​​​​​​​在​​​​​​​。​​​​​​​
    现​​​​​​​在​​​​​​​的​​​​​​​ sys 文​​​​​​​件​​​​​​​系​​​​​​​统​​​​​​​包​​​​​​​括​​​​​​​了​​​​​​​以​​​​​​​前​​​​​​​存​​​​​​​在​​​​​​​ /etc/chandev.conf 中​​​​​​​的​​​​​​​信​​​​​​​息​​​​​​​。​​​​​​​
  • /etc/modules.conf 不​​​​​​​再​​​​​​​存​​​​​​​在​​​​​​​。​​​​​​​
    网​​​​​​​络​​​​​​​接​​​​​​​口​​​​​​​别​​​​​​​名​​​​​​​表​​​​​​​现​​​​​​​在​​​​​​​被​​​​​​​存​​​​​​​在​​​​​​​ /etc/modprobe.conf 中​​​​​​​。​​​​​​​

22.6.1. 添​​​​​​​加​​​​​​​ qeth 设​​​​​​​备​​​​​​​

首​​​​​​​先​​​​​​​,确​​​​​​​定​​​​​​​ qeth 设​​​​​​​备​​​​​​​驱​​​​​​​动​​​​​​​模​​​​​​​块​​​​​​​是​​​​​​​否​​​​​​​已​​​​​​​经​​​​​​​被​​​​​​​加​​​​​​​载​​​​​​​。​​​​​​​
# lsmod | grep qeth
qeth                  135240  0
qdio                   45360  2 qeth
ipv6                  303984  13 qeth
ccwgroup               15104  1 qeth
如​​​​​​​果​​​​​​​ lsmod 命​​​​​​​令​​​​​​​的​​​​​​​输​​​​​​​出​​​​​​​显​​​​​​​示​​​​​​​这​​​​​​​个​​​​​​​模​​​​​​​块​​​​​​​还​​​​​​​没​​​​​​​有​​​​​​​被​​​​​​​加​​​​​​​载​​​​​​​,你​​​​​​​需​​​​​​​要​​​​​​​运​​​​​​​行​​​​​​​ modprobe 命​​​​​​​令​​​​​​​去​​​​​​​加​​​​​​​载​​​​​​​它​​​​​​​们​​​​​​​。​​​​​​​
# modprobe qeth
然​​​​​​​后​​​​​​​,建​​​​​​​立​​​​​​​一​​​​​​​个​​​​​​​ qeth 组​​​​​​​设​​​​​​​备​​​​​​​。​​​​​​​
# echo read_device_bus_id,write_device_bus_id,
data_device_bus_id > /sys/bus/ccwgroup/drivers/qeth/group
Due to the length of this command, it has been broken into two lines.
在​​​​​​​以​​​​​​​下​​​​​​​的​​​​​​​例​​​​​​​子​​​​​​​中​​​​​​​,read_device_bus_id 是​​​​​​​ 0.0.0600,write_device_bus_id 是​​​​​​​ 0.0.0601,data_device_bus_id 是​​​​​​​ 0.0.0602。​​​​​​​这​​​​​​​个​​​​​​​设​​​​​​​备​​​​​​​是​​​​​​​一​​​​​​​个​​​​​​​ z/VM 虚​​​​​​​拟​​​​​​​网​​​​​​​卡​​​​​​​,它​​​​​​​所​​​​​​​被​​​​​​​分​​​​​​​配​​​​​​​的​​​​​​​ IP 地​​​​​​​址​​​​​​​是​​​​​​​ 192.168.70.69。​​​​​​​
# echo 0.0.0600,0.0.0601,0.0.0602 > /sys/bus/ccwgroup/drivers/qeth/group
然​​​​​​​后​​​​​​​,检​​​​​​​查​​​​​​​ qeth 组​​​​​​​设​​​​​​​备​​​​​​​是​​​​​​​否​​​​​​​已​​​​​​​被​​​​​​​正​​​​​​​确​​​​​​​地​​​​​​​建​​​​​​​好​​​​​​​。​​​​​​​
# ls /sys/bus/ccwgroup/drivers/qeth
0.0.0600  0.0.09a0  group  notifier_register
你​​​​​​​可​​​​​​​以​​​​​​​添​​​​​​​加​​​​​​​一​​​​​​​个​​​​​​​端​​​​​​​口​​​​​​​名​​​​​​​。​​​​​​​首​​​​​​​先​​​​​​​,你​​​​​​​需​​​​​​​要​​​​​​​检​​​​​​​查​​​​​​​是​​​​​​​否​​​​​​​需​​​​​​​要​​​​​​​一​​​​​​​个​​​​​​​端​​​​​​​口​​​​​​​名​​​​​​​:
# cat /sys/bus/ccwgroup/drivers/qeth/0.0.0600/portname
no portname required
应​​​​​​​答​​​​​​​显​​​​​​​示​​​​​​​你​​​​​​​不​​​​​​​需​​​​​​​要​​​​​​​提​​​​​​​供​​​​​​​端​​​​​​​口​​​​​​​名​​​​​​​。​​​​​​​
添​​​​​​​加​​​​​​​一​​​​​​​个​​​​​​​端​​​​​​​口​​​​​​​名​​​​​​​,首​​​​​​​先​​​​​​​要​​​​​​​检​​​​​​​查​​​​​​​设​​​​​​​备​​​​​​​不​​​​​​​在​​​​​​​线​​​​​​​,然​​​​​​​后​​​​​​​运​​​​​​​行​​​​​​​以​​​​​​​下​​​​​​​命​​​​​​​令​​​​​​​:

注意

在​​​​​​​添​​​​​​​加​​​​​​​端​​​​​​​口​​​​​​​名​​​​​​​的​​​​​​​时​​​​​​​候​​​​​​​,设​​​​​​​备​​​​​​​必​​​​​​​须​​​​​​​是​​​​​​​不​​​​​​​在​​​​​​​线​​​​​​​的​​​​​​​。​​​​​​​
# echo portname > /sys/bus/ccwgroup/drivers/qeth/0.0.0600/portname
然​​​​​​​后​​​​​​​,让​​​​​​​系​​​​​​​统​​​​​​​在​​​​​​​线​​​​​​​。​​​​​​​
# echo 1 /sys/bus/ccwgroup/drivers/qeth/0.0.0600/online
接​​​​​​​下​​​​​​​来​​​​​​​检​​​​​​​查​​​​​​​设​​​​​​​备​​​​​​​的​​​​​​​状​​​​​​​态​​​​​​​:
# cat /sys/bus/ccwgroup/drivers/qeth/0.0.0600/online1
A return value of "1" indicates that the device is online, while a return value '0' indicates that the device is offline.
检​​​​​​​查​​​​​​​这​​​​​​​个​​​​​​​设​​​​​​​备​​​​​​​被​​​​​​​分​​​​​​​配​​​​​​​的​​​​​​​接​​​​​​​口​​​​​​​名​​​​​​​。​​​​​​​
# cat /sys/bus/ccwgroup/drivers/qeth/0.0.0600/if_name
eth1
改​​​​​​​变​​​​​​​ if_name 的​​​​​​​值​​​​​​​,可​​​​​​​以​​​​​​​运​​​​​​​行​​​​​​​以​​​​​​​下​​​​​​​命​​​​​​​令​​​​​​​:
# echo new_if_name > /sys/bus/ccwgroup/drivers/qeth/0.0.0600/if_name
根​​​​​​​据​​​​​​​你​​​​​​​的​​​​​​​系​​​​​​​统​​​​​​​设​​​​​​​置​​​​​​​情​​​​​​​况​​​​​​​以​​​​​​​及​​​​​​​你​​​​​​​所​​​​​​​需​​​​​​​要​​​​​​​的​​​​​​​功​​​​​​​能​​​​​​​,你​​​​​​​可​​​​​​​能​​​​​​​会​​​​​​​设​​​​​​​置​​​​​​​其​​​​​​​他​​​​​​​一​​​​​​​些​​​​​​​参​​​​​​​数​​​​​​​和​​​​​​​特​​​​​​​性​​​​​​​。​​​​​​​
  • add_hhlen
  • broadcast_mode
  • buffer_count
  • canonical_macaddr
  • card_type
  • checksumming
  • chpid
  • detach_state
  • fake_broadcast
  • fake_ll
  • ipa_takeover
  • portno
  • priority_queueing
  • recover
  • route4
  • rxip
  • state
  • ungroup
  • vipa
如​​​​​​​果​​​​​​​需​​​​​​​要​​​​​​​了​​​​​​​解​​​​​​​这​​​​​​​些​​​​​​​功​​​​​​​能​​​​​​​如​​​​​​​何​​​​​​​工​​​​​​​作​​​​​​​,请​​​​​​​参​​​​​​​阅​​​​​​​ http://www-128.ibm.com/developerworks/linux/linux390/october2005_documentation.html#3 (Device Drivers, Features, and Commands - SC33-8289-02)。​​​​​​​
现​​​​​​​在​​​​​​​,你​​​​​​​需​​​​​​​要​​​​​​​为​​​​​​​你​​​​​​​的​​​​​​​新​​​​​​​接​​​​​​​口​​​​​​​建​​​​​​​立​​​​​​​一​​​​​​​个​​​​​​​配​​​​​​​置​​​​​​​文​​​​​​​件​​​​​​​。​​​​​​​这​​​​​​​个​​​​​​​配​​​​​​​置​​​​​​​文​​​​​​​件​​​​​​​被​​​​​​​存​​​​​​​放​​​​​​​在​​​​​​​ /etc/sysconfig/network-scripts/。​​​​​​​
这​​​​​​​个​​​​​​​网​​​​​​​络​​​​​​​配​​​​​​​置​​​​​​​文​​​​​​​件​​​​​​​的​​​​​​​命​​​​​​​名​​​​​​​规​​​​​​​则​​​​​​​是​​​​​​​: ifcfg-device,其​​​​​​​中​​​​​​​ "device" 是​​​​​​​在​​​​​​​早​​​​​​​些​​​​​​​时​​​​​​​候​​​​​​​建​​​​​​​立​​​​​​​的​​​​​​​ qeth 组​​​​​​​中​​​​​​​的​​​​​​​ if_name 中​​​​​​​相​​​​​​​应​​​​​​​的​​​​​​​值​​​​​​​。​​​​​​​在​​​​​​​这​​​​​​​个​​​​​​​例​​​​​​​子​​​​​​​中​​​​​​​是​​​​​​​ eth1。​​​​​​​
如​​​​​​​果​​​​​​​有​​​​​​​一​​​​​​​个​​​​​​​相​​​​​​​似​​​​​​​设​​​​​​​备​​​​​​​的​​​​​​​配​​​​​​​置​​​​​​​文​​​​​​​件​​​​​​​已​​​​​​​经​​​​​​​在​​​​​​​以​​​​​​​前​​​​​​​建​​​​​​​立​​​​​​​了​​​​​​​,一​​​​​​​个​​​​​​​简​​​​​​​单​​​​​​​的​​​​​​​办​​​​​​​法​​​​​​​是​​​​​​​拷​​​​​​​贝​​​​​​​这​​​​​​​个​​​​​​​文​​​​​​​件​​​​​​​并​​​​​​​起​​​​​​​一​​​​​​​个​​​​​​​新​​​​​​​的​​​​​​​名​​​​​​​字​​​​​​​。​​​​​​​
# cd /etc/sysconfig/network-scripts
# cp ifcfg-eth0 ifcfg-eth1
如​​​​​​​果​​​​​​​没​​​​​​​有​​​​​​​相​​​​​​​似​​​​​​​的​​​​​​​设​​​​​​​备​​​​​​​,你​​​​​​​必​​​​​​​须​​​​​​​自​​​​​​​己​​​​​​​建​​​​​​​立​​​​​​​一​​​​​​​个​​​​​​​。​​​​​​​可​​​​​​​以​​​​​​​把​​​​​​​ ifcfg-eth0 的​​​​​​​例​​​​​​​子​​​​​​​当​​​​​​​成​​​​​​​一​​​​​​​个​​​​​​​模​​​​​​​板​​​​​​​。​​​​​​​
/etc/sysconfig/network-scripts/ifcfg-eth0
# IBM QETH
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:06:29:FB:5F:F1
IPADDR=9.12.20.136
NETMASK=255.255.255.0
ONBOOT=yes
NETTYPE=qeth
SUBCHANNELS=0.0.09a0,0.0.09a1,0.0.09a2
TYPE=Ethernet
编​​​​​​​辑​​​​​​​新​​​​​​​的​​​​​​​ ifcfg-eth1 文​​​​​​​件​​​​​​​。​​​​​​​
删​​​​​​​去​​​​​​​ HWADDR 行​​​​​​​。​​​​​​​
根​​​​​​​据​​​​​​​你​​​​​​​的​​​​​​​ ccw 组​​​​​​​的​​​​​​​ if_name 文​​​​​​​件​​​​​​​,修​​​​​​​改​​​​​​​ DEVICE 的​​​​​​​值​​​​​​​。​​​​​​​
根​​​​​​​据​​​​​​​你​​​​​​​的​​​​​​​新​​​​​​​的​​​​​​​接​​​​​​​口​​​​​​​的​​​​​​​ IP 地​​​​​​​址​​​​​​​修​​​​​​​改​​​​​​​ IPADDR 的​​​​​​​值​​​​​​​。​​​​​​​
如​​​​​​​果​​​​​​​需​​​​​​​要​​​​​​​,修​​​​​​​改​​​​​​​ NETMASK 的​​​​​​​值​​​​​​​。​​​​​​​
如​​​​​​​果​​​​​​​你​​​​​​​需​​​​​​​要​​​​​​​你​​​​​​​的​​​​​​​新​​​​​​​接​​​​​​​口​​​​​​​系​​​​​​​统​​​​​​​在​​​​​​​启​​​​​​​动​​​​​​​的​​​​​​​时​​​​​​​候​​​​​​​被​​​​​​​激​​​​​​​活​​​​​​​,设​​​​​​​置​​​​​​​ ONBOOT 为​​​​​​​ yes。​​​​​​​
检​​​​​​​查​​​​​​​ SUBCHANNELS 的​​​​​​​值​​​​​​​和​​​​​​​你​​​​​​​的​​​​​​​ qeth 设​​​​​​​备​​​​​​​的​​​​​​​硬​​​​​​​件​​​​​​​地​​​​​​​址​​​​​​​一​​​​​​​致​​​​​​​。​​​​​​​
/etc/sysconfig/network-scripts/ifcfg-eth1
# IBM QETH
DEVICE=eth1
BOOTPROTO=static
IPADDR=192.168.70.87
NETMASK=255.255.255.0
ONBOOT=yes
NETTYPE=qeth
SUBCHANNELS=0.0.0600,0.0.0601,0.0.0602
TYPE=Ethernet
每​​​​​​​个​​​​​​​ qeth 设​​​​​​​备​​​​​​​都​​​​​​​需​​​​​​​要​​​​​​​在​​​​​​​ /etc/modprobe.conf 中​​​​​​​定​​​​​​​义​​​​​​​一​​​​​​​个​​​​​​​别​​​​​​​名​​​​​​​。​​​​​​​编​​​​​​​辑​​​​​​​这​​​​​​​个​​​​​​​文​​​​​​​件​​​​​​​,为​​​​​​​你​​​​​​​的​​​​​​​新​​​​​​​接​​​​​​​口​​​​​​​加​​​​​​​入​​​​​​​一​​​​​​​个​​​​​​​别​​​​​​​名​​​​​​​。​​​​​​​
/etc/modprobe.conf
alias eth0 qeth
alias eth1 qeth
options dasd_mod dasd=0.0.0100,0.0.4b19
现​​​​​​​在​​​​​​​你​​​​​​​可​​​​​​​以​​​​​​​使​​​​​​​用​​​​​​​新​​​​​​​接​​​​​​​口​​​​​​​了​​​​​​​。​​​​​​​
# ifup eth1
检​​​​​​​查​​​​​​​接​​​​​​​口​​​​​​​的​​​​​​​状​​​​​​​态​​​​​​​:
# ifconfig eth1
eth1      Link encap:Ethernet  HWaddr 02:00:00:00:00:01
          inet addr:192.168.70.87  Bcast:192.168.70.255  Mask:255.255.255.0
          inet6 addr: fe80::ff:fe00:1/64 Scope:Link
          UP BROADCAST RUNNING NOARP MULTICAST  MTU:1492  Metric:1
          RX packets:23 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:644 (644.0 b)  TX bytes:264 (264.0 b)
注​​​​​​​意​​​​​​​在​​​​​​​ ifconfig 命​​​​​​​令​​​​​​​结​​​​​​​果​​​​​​​输​​​​​​​出​​​​​​​的​​​​​​​第​​​​​​​一​​​​​​​行​​​​​​​的​​​​​​​ HWaddr,在​​​​​​​它​​​​​​​后​​​​​​​面​​​​​​​的​​​​​​​值​​​​​​​必​​​​​​​须​​​​​​​被​​​​​​​加​​​​​​​入​​​​​​​到​​​​​​​ ifcfg-eth1 文​​​​​​​件​​​​​​​中​​​​​​​。​​​​​​​加​​​​​​​入​​​​​​​如​​​​​​​下​​​​​​​一​​​​​​​行​​​​​​​到​​​​​​​那​​​​​​​个​​​​​​​文​​​​​​​件​​​​​​​。​​​​​​​
HWADDR=02:00:00:00:00:01
现​​​​​​​在​​​​​​​,ifcfg-eth1 会​​​​​​​和​​​​​​​如​​​​​​​下​​​​​​​的​​​​​​​文​​​​​​​件​​​​​​​非​​​​​​​常​​​​​​​象​​​​​​​:
# IBM QETH
DEVICE=eth1
HWADDR=02:00:00:00:00:01
BOOTPROTO=static
IPADDR=192.168.70.69
NETMASK=255.255.255.0
ONBOOT=yes
NETTYPE=qeth
SUBCHANNELS=0.0.0600,0.0.0601,0.0.0602
TYPE=Ethernet
检​​​​​​​查​​​​​​​新​​​​​​​接​​​​​​​口​​​​​​​的​​​​​​​路​​​​​​​由​​​​​​​:
# route
Kernel IP routing table
Destination     Gateway         Genmask        Flags Metric Ref  Use Iface
192.168.70.0    *               255.255.255.0  U     0      0      0 eth1
9.12.20.0       *               255.255.255.0  U     0      0      0 eth0
169.254.0.0     *               255.255.0.0    U     0      0      0 eth1
default         pdlrouter-if5.p 0.0.0.0        UG    0      0      0 eth0
使​​​​​​​用​​​​​​​ ping 命​​​​​​​令​​​​​​​去​​​​​​​ ping 网​​​​​​​关​​​​​​​来​​​​​​​检​​​​​​​查​​​​​​​你​​​​​​​的​​​​​​​设​​​​​​​置​​​​​​​:
# ping -c 1 192.168.70.8
PING 192.168.70.8 (192.168.70.8) 56(84) bytes of data.
64 bytes from 192.168.70.8: icmp_seq=0 ttl=63 time=8.07 ms
如​​​​​​​果​​​​​​​缺​​​​​​​省​​​​​​​的​​​​​​​路​​​​​​​由​​​​​​​信​​​​​​​息​​​​​​​被​​​​​​​改​​​​​​​变​​​​​​​了​​​​​​​,你​​​​​​​必​​​​​​​须​​​​​​​更​​​​​​​新​​​​​​​相​​​​​​​应​​​​​​​的​​​​​​​ /etc/sysconfig/network

为了尽快向用户提供最新的信息,本文档可能会包括由机器自动从英文原文翻译的内容。如需更多信息,请参阅此说明。