. rc.inet1 , rc.inet /etc/rc, . , "telnet localhost" telnet . , loopback , , . , , . 6.7.2. Ethernet Ethernet, loopback, . , IP , B. : # ifconfig eth0 vstout netmask 255.255.255.0 eth0 IP vstout (191.72.1.2). netmask, ifconfig netmask , netmask 255.255.0.0. : # ifconfig eth0 eth0 Link encap 10Mps Ethernet HWaddr 00:00:C0:90:B3:42 inet addr 191.72.1.2 Bcast 191.72.1.255 Mask 255.255.255.0 UP BROADCAST RUNNING MTU 1500 Metric 1 RX packets 0 errors 0 dropped 0 overrun 0 - 88 - TX packets 0 errors 0 dropped 0 overrun 0 ifconfig ( Bcast) , 1. , ( Ethernet ) 1500 . , . loopback , , , eth0. , # route add -net 191.72.1.0 , route , . , : ( 191.72.1.0) . , , -- eth0. , -net ? , route ( localhost). route dotted quad , , . - , , , , . , route , 191.72.1.0 - , . , , -net . , , - 89 - . -- , /etc/networks. ; -net , route , 191.72.1.0 . # route add brew-net , , Ethernet Ethernet, vlager, # ping vlager PING vlager: 64 byte packets 64 bytes from 191.72.1.1: icmp seq=0. time=11. ms 64 bytes from 191.72.1.1: icmp seq=1. time=7. ms 64 bytes from 191.72.1.1: icmp seq=2. time=12. ms 64 bytes from 191.72.1.1: icmp seq=3. time=3. ms ^C ----vstout.vbrew.com PING Statistics---- 4 packets transmitted, 4 packets received, 0% packet loss round-trip (ms) min/avg/max = 3/8/12 , - . , , terminator, ... , netstat. , ifconfig, - . , . , , . , route, . route , ( -n ): - 90 - # route -n Kernel routing table Destination Gateway Genmask Flags Metric Ref Use Iface 127.0.0.1 * 255.255.255.255 UH 1 0 112 lo 191.72.1.0 * 255.255.255.0 U 1 0 10 eth0 6.9. Flags . U - , H , . H - , , -net route. ( , , , Use, ping.) To check whether a route you have entered is used at all, check if the Use field in the second to last column increases between two invocations of ping. 6.7.3. Gateway , Ethernet. , , , gateway. gateway Ethernet, , ( Internet). gateway , . , Ethernet gateway, vlager. , vlager , vstout, vlager. ; gw , gateway. # route add wine-net gw vlager , , - 91 - , vstout vbardolino, . gateway Ethernet. vlager Internet ( SLIP ). , , vlager. gateway vstout: # route add default gw vlager default( ) 0.0.0.0, . /etc/networks, route. , ping, gateway, . - , , - . 6.7.4. Gateway Ethernet . vlager, Ethernet , . , , IP , . , : - 92 - 191.72.1.1 vlager vlager.vbrew.com 191.72.1.1 vlager-if1 191.72.2.1 vlager-if2 : # ifconfig eth0 vlager-if1 # ifconfig eth1 vlager-if2 # route add brew-net # riute add wine-net 6.7.5. PLIP PLIP , , Ethernet. point-to-point( ) , (""), . , laptop , vlager PLIP. Laptop vlite, . , plip1. , plip1, : # ifconfig plip1 vlite pointopoint vlager # route add default gw vlager , , point-to-point , vlager. , vlager gateway. vlager, ifconfig vlager: - 93 - # ifconfig plip1 vlager pointopoint vlite , plip1 vlager IP , 191.72.1.1. , laptop ; vlite. o , , vlager gateway vlite: # route add vlite gw vlager , . o gated , , . , , o , proxy ARP. proxy ARP, vlager ARP pf vlite Ethernet . , vlite vlager, laptop. proxy ARP 6.10. Net-3 plipconfig, IRQ . , ifconfig. 6.7.6. SLIP PPP SLIP PPP -- point-to-point PLIP , . , SLIP , SLIP . PPP . SLIP PPP 8. 9. - 94 - 6.7.7. Dummy() , . , , . , . , , loopback , 127.0.0.1. , "" IP . , laptop vlite, vlite . vlite /etc/hosts IP 191.72.1.65, . loopback , ! , , . . loopback. vlite, 191.72.1.65 . 191.72.1.65 . : # ifconfig dummy vlite # route add vlite 6.8. ifconfig ifconfig, . : ifconfig interface [[-net|-host] address [parameters]] interface - , address - IP - 95 - . IP dotted quad , , ifconfig /etc/hosts /etc/networks. -net -host ifconfig , . ifconfig , . , , ; -a . Ethernet eth0 : # ifconfig eth0 eth0 Link encap 10Mbps Ethernet HWaddr 00:00:C0:90:B3:42 inet addr 191.72.1.2 Bcast 191.72.1.255 Mask 255.255.255.0 UP BROADCAST RUNNING MTU 1500 Metric 0 RX packets 3136 errors 217 dropped 7 overrun 26 TX packets 1752 errors 25 dropped 0 overrun 0 MTU Metric MTU . . Linux , . RX TX , , , - , - . . , ifconfig, ; . ifconfig , . , (-). - 96 - up IP . , IP . ( UP RUNNING ) down IP . IP . , , . , , , . netmask mask . 32 , 0x, dotted quad . Pointopoint adress point-to-point IP . , , SLIP PLIP . ( point-to-point , ifconfig POINTOPOINT .) broadcast address . IP ; . ( broadcast address , ifconfig BROADCAST .) metric number . RIP, . . RIP , ; , - 97 - . mtu bytes Maximum Transmission Unit ( ) Ethernets, MTU 1500; SLIP 296. arp Ethernet. ARP, , . , . ( ARP , ifconfig NOARP. ) -arp ARP . promisc promiscuous . , , . , , . , . , . . , Kerberos, SRA login. ( PROMISC.) -promisc promiscuous . allmulti Multicast -- , - 98 - . Multicast . ( ALLMULTI. ) -allmulti Multicast . 6.9. netstat , . netstat ,, . . 6.9.1. netstat -r , . vstout, : # netstat -nr Kernel routing table Destination Gateway Genmask Flags Metric Ref Use Iface 127.0.0.1 * 255.255.255.255 UH 1 0 50 lo 191.72.1.0 * 255.255.255.0 U 1 0 478 eth0 191.72.2.0 191.72.1.1 255.255.255.0 UGN 1 0 250 eth0 -n netstat dotted quad IP . ( DNS NIS ). netstat gateway . gateway , . "" . IP , , , genmask . - 99 - , : G gateway. U , , . H . , loopback 127.0.0.1. D , ICMP ( . 3.5 ). M , ICMP . Ref , ( gateways) . , , , . 6.9.2. -i , netstat . , , -a , , , . vstaout, netstat : $ netstat -i Kernel Interface table Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flags lo 0 0 3185 0 0 0 3185 0 0 0 BLRU eth0 1500 0 972633 17 20 120 628711 217 0 0 BRU MTU Met MTU . RX TX - 100 - (RX-OK/TX-OK), (RX-ERR/TXERR), (RX-DRP/TX-DRP), - (RX-OVR/TX-OVR). , . , ifconfig. B . L -- loopback M ( promiscuous ). N . O ARP . P - point-to-point . R . U . 6.9.3. Netstat . -t, -u, -w, -x TCP, UDP, RAW , UNIX . -a , ( ) . . netstat -ta vlager : $ netstat -ta Active Internet connections Proto Recv-Q Send-Q Local Address Foreign Address (State) - 101 - tcp 0 0 *:domain *:* LISTEN tcp 0 0 *:time *:* LISTEN tcp 0 0 *:smtp *:* LISTEN tcp 0 0 vlager:smtp vstout:1040 ESTABLISHED tcp 0 0 *:telnet *:* LISTEN tcp 0 0 localhost:1046 vbardolino:telnet ESTABLISHED tcp 0 0 *:chargen *:* LISTEN tcp 0 0 *:daytime *:* LISTEN tcp 0 0 *:discard *:* LISTEN tcp 0 0 *:echo *:* LISTEN tcp 0 0 *:shell *:* LISTEN tcp 0 0 *:login *:* LISTEN , . , SMTP vstout, telnet vbardolino. -a . 6.10. ARP , ARP , , , . rp . Arp [-v] [ -t hwtype ] -a [hostname] arp [-v] [ -t hwtype ] -s hostname hwaddr arp [-v] -d hostname [ hostname ... ] hostname , IP dotted quad . ARP IP , hostname . , arp vlager - 102 - # arp -a IP address HW type HW address 191.72.1.3 10Mbps Ethernet 00:00:C0:5A:42:C1 191.72.1.2 10Mbps Ethernet 00:00:C0:90:B3:42 191.72.2.4 10Mbps Ethernet 00:00:C0:04:69:AA Ethernet vlager, vstout vale. -t , . ethernet, ax25net, pronet, 10Mbps Ethernet, AMPR AX.25, IEEE 802.5 token ring , . -s Ethernet ARP . hwaddr , Ethernet , , . , , -t . , , IP ARP , ARP , ARP IP . IP ARP ( ) Ethernet, - . arp -d ARP . , Ethernet IP. ARP . -s proxy ARP. , gate, gateway fnord, , gate. : gate ARP fnord, Ethernet - 103 - . ARP fnord, gate Ethernet . gate, fnord. , , fnord DOS TCP, . proxy ARP, DOS , fnord , - gateway. proxy ARP -- gateway , . , laptop vlite, vlager PLIP . , , , proxy ARP, IP , gateway. , vstout proxy ARP (191.72.1.0), (191.72.2.0). proxy ARP fnord ; , Ethernet gate. # arp -s fnord 00:00:c0:a1:42:e0 pub proxy ARP : # arp -d fnord 6.11. Linux . , . , ifconfig , IRQ DMA . -- mtu route, - 104 - . - MTU MTU . gateway, gateway MTU. , wanderer vlager SLIP . vstout wanderer, wanderer 1500 , Ethernet. SLIP , , MTU 296, vlager IP , 296 . , vstout , MTU 296, : # route add wanderer gw vlager mtu 296 mtu " " (SNARL). -- 4. . - 105 - 7. . 3., TCP/IP , . , , , - , /etc/hosts. LAN, , IP . 6. , BIND - Berkeley Internet Name Domain Service - IP . BIND , , . Linux, Unix- c, , named. , , . , . , . BIND LAN Internet uplink, BIND, "DNS and BIND" (. [GETST "liu-dns"]). , BIND . newsgroup DNS comp.protocols.tcp-ip.domains. 7.1 . " ", , - , C. gethostbyname(2) gethostbyaddr(2), IP , . , , NIS() (Network Information Service). , smail, - 106 - , . 7.1.1 . , - host.conf. , . host.conf . (spaces tabs). (#) , . : Order: . Valid - /etc/hosts, nis NIS . . , . Multi: . , /etc/hosts IP , "multi - homed". DNS NIS . Nospoof: , DNS IP , inaddr.arpa . "spoofing". , , IP . , . nospoof. Alert: . , spoof (. ) - 107 - , syslog . Trim: , . , . , , /etc/hosts. Trim . vlager : # /etc/host.conf # We have named running, but no NIS (yet) order bind hosts # Allow multiple addrs multi on # Guard against spoof attempts nospoof on # Trim local dooain"(not really necessary). trim vbrew.com. 7.1.2 . host.conf , . : RESOLV HOST CONF. , /etc/host.conf. RESOLV SERV ORDER order , host.conf. , , bind, nis, , , , . - 108 - RESOLV SPOOF CHECK , spoofing. off. spoof , logging, . * spoof , logging host.conf. RESOLV MULTI ( . .), multi tt host.conf. RESOLV OVERRIDE TRIM DOMAINS trim , , host.conf. RESOLV ADD TRIM DOMAINS trim , host.conf. 7.1.3 --- resolv.conf , BIND , , . , , resolv.conf. , , . , , , . , . resolv.conf - nameserver, IP . nameserver , . . , . nameserver , - 109 - . , domain search , , BIND . search , . . search , , , root. ; , getdomainname(2) . , resolv.conf Virtual Brewery: # /etc/resolv.conf # Our domain domain vbrew.com # # We use vl