Limited output. Warning: cannot open
methody@localhost:~ $ ifconfig -bash: ifconfig: command not found methody@localhost:~ $ /sbin/ifconfig Warning: cannot open /proc/net/dev (Permission denied). Limited output. Warning: cannot open /proc/net/dev (Permission denied). Limited output. eth0 Link encap:Ethernet HWaddr 00:0C:29:56:C1:36 inet addr:192.168.102.125 Bcast:192.168.102.255 Mask:255.255.255.0 UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1 Warning: cannot open /proc/net/dev (Permission denied). Limited output. lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 |
Пример 14.1. Запуск ifconfig |
Закрыть окно |
[root@localhost root]# arp -a fuji.nipponman.ru (192.168.102.1) at 00:50:56:C0:00:01 [ether] on eth0 edoh.nipponman.ru (192.168.102.7) at 00:50:56:C3:11:a2 [ether] on eth0 [root@localhost root]# sleep 60 [root@localhost root]# arp -a [root@localhost root]# ping -c1 192.168.102.1 PING 192.168.102.1 (192.168.102.1) 56(84) bytes of data. 64 bytes from 192.168.102.1: icmp_seq=1 ttl=64 time=0.217 ms --- 192.168.102.1 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.217/0.217/0.217/0.000 ms [root@localhost root]# arp -a fuji.nipponman.ru (192.168.102.1) at 00:50:56:C0:00:01 [ether] on eth0 |
Пример 14.2. Просмотр таблицы ARP |
Закрыть окно |
[root@localhost root]# route - n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.102.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo 0.0.0.0 192.168.102.1 0.0.0.0 UG 0 0 0 eth0 |
Пример 14.3. Простая таблица маршрутизации |
Закрыть окно |
[root@fuji root]# route - n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 83.237.29.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0 192.168.102.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 10.13.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0 127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo 0.0.0.0 83.237.29.1 0.0.0.0 UG 0 0 0 ppp0 [root@fuji root]# ifconfig ppp0 ppp0 Link encap:Point-to-Point Protocol inet addr:83.237.29.51 P-t-P:83.237.29.1 Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1 RX packets:17104 errors:0 dropped:0 overruns:0 frame:0 TX packets:23839 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:3 RX bytes:5879278 (5.6 Mb) TX bytes:1750644 (1.6 Mb) |
Пример 14.4. Сложная таблица маршрутизации |
Закрыть окно |
[root@localhost root]# traceroute www.ru -n traceroute to www.ru (194.87.0.50), 30 hops max, 38 byte packets 1 192.168.102.1 0.223 ms 0.089 ms 0.105 ms 2 83.237.29.1 25.599 ms 21.390 ms 21.812 ms 3 195.34.53.53 24.111 ms 21.213 ms 25.778 ms 4 195.34.53.53 23.614 ms 33.172 ms 22.238 ms 5 195.34.53.10 43.552 ms 48.731 ms 44.402 ms 6 195.34.53.81 26.805 ms 21.307 ms 22.138 ms 7 213.248.67.93 41.737 ms 41.565 ms 42.265 ms 8 213.248.66.9 50.239 ms 47.081 ms 64.781 ms 9 213.248.65.42 99.002 ms 81.968 ms 62.771 ms 10 213.248.78.170 62.768 ms 63.751 ms 78.959 ms 11 194.87.0.66 101.865 ms 88.289 ms 66.340 ms 12 194.87.0.50 70.881 ms 67.340 ms 63.791 ms |
Пример 14.5. Определения маршрута пакета |
Закрыть окно |
[root@localhost root]# wc /etc/services 553 2794 19869 /etc/services [root@localhost root]# egrep "^(ftp|http|smtp|ssh).*tcp" /etc/services ftp 21/tcp # File Transfer [Control] ssh 22/tcp # SSH Remote Login Protocol smtp 25/tcp mail # Simple Mail Transfer Protocol http 80/tcp www www-http # World Wide Web HTTP |
Пример 14.6. Постоянные номера портов для некоторых протоколов |
Закрыть окно |
[root@localhost root]# netstat - anA inet Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN tcp 0 0 192.168.102.125:22 192.168.102.1:33208 ESTABLISHED udp 0 0 0.0.0.0:11 0.0.0.0:* |
Пример 14.7. Просмотр установленных соединений и служб |
Закрыть окно |
[root@localhost root]# telnet 192.168.102. 1 112 Trying 192.168.102.1... telnet: connect to address 192.168.102.1: Connection refused [root@localhost root]# telnet 192.168.102.1 111 Trying 192.168.102.1... Connected to 192.168.102.1. Escape character is '^]'. ^[ telnet> close Connection closed. |
Пример 14.8. Использование telnet |
Закрыть окно |
[root@localhost root]# grep quake /etc/services quake 26000/tcp quake 26000/udp [root@localhost root]# cat /etc/xinetd.d/ calendar service quake { socket_type = stream protocol = tcp wait = no user = nobody server = /usr/bin/cal disable = no } |
Пример 14.9. Настройка cal в качестве сетевой службы |
Закрыть окно |
[root@localhost root]# service xinetd restart Stopping xinetd service: [ DONE ] Starting xinetd service: [ DONE ] [root@localhost root]# telnet localhost quake Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. December 2004 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
Пример 14.10. Подключение к самодельной службе "календарь" |
Закрыть окно |
order hosts,bind multi on [root@localhost root]# cat /etc/resolv.conf domain nipponman.ru nameserver 192.168.102.1 [root@localhost root]# traceroute -q1 www.ru traceroute to www.ru (194.87.0.50), 30 hops max, 38 byte packets 1 fuji.nipponman.ru (192.168.102.1) 1.378 ms 2 ppp83-237-29-1.pppoe.mtu-net.ru (83.237.29.1) 41.155 ms 3 195.34.53.53 (195.34.53.53) 48.503 ms 4 195.34.53.53 (195.34.53.53) 24.033 ms 5 M9-cr01-A197-cr01.core.mtu.ru (195.34.53.10) 33.414 ms 6 M9-gw2-M9-cr01.core.mtu.ru (195.34.53.81) 26.259 ms 7 s-b3-pos0-0.telia.net (213.248.67.93) 59.791 ms 8 s-bb1-pos5-0-0.telia.net (213.248.66.1) 67.011 ms 9 mow-b1-pos1-0.telia.net (213.248.101.10) 76.138 ms 10 demos-101566-mow-okt-i1.c.telia.net (213.248.78.170) 78.591 ms 11 m9-3-GE4-0-0-vl10.Demos.net (194.87.0.66) 69.813 ms 12 www.ru (194.87.0.50) 70.583 ms |
Пример 14.11. Работа DNS-клиента, встроенного в traceroute |
Закрыть окно |
methody@localhost:~ $ host www.ru www.ru has address 194.87.0.50 methody@localhost:~ $ host 194.87.0.51 51.0.87.194.in-addr.arpa domain name pointer www.demos-internet.ru. methody@localhost:~ $ host -t ns www.ru www.ru name server ns.demos.su. www.ru name server ns1.demos.net. methody@localhost:~ $ host -t mx www.ru www. ru mail is handled by 5 hq.demos.ru. |
Пример 14.12. Утилита host |
Закрыть окно |
methody@localhost:~ $ dig www.us any ; <<>> DiG 9.2.4rc5 <<>> www.us any ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6451 ;; flags: qr rd ra; QUERY: 1, ANSWER: 10, AUTHORITY: 0, ADDITIONAL: 4 ;; QUESTION SECTION: ;www.us. IN ANY ;; ANSWER SECTION: www.us. 1766 IN A 209.173.57.26 www.us. 1766 IN A 209.173.53.26 www.us. 1767 IN NS pine.neustar.com. www.us. 1767 IN NS willow.neustar.com. www.us. 1767 IN NS cypress.neustar.com. www.us. 1767 IN NS oak.neustar.com. www.us. 1771 IN MX 20 pine.neustar.com. www.us. 1771 IN MX 5 oak.neustar.com. www.us. 1771 IN MX 5 willow.neustar.com. www.us. 1771 IN MX 10 cypress.neustar.com. ;; ADDITIONAL SECTION: pine.neustar.com. 135024 IN A 209.173.57.70 willow.neustar.com. 135024 IN A 209.173.53.84 cypress.neustar.com. 135024 IN A 209.173.57.84 oak.neustar.com. 135024 IN A 209.173.53.70 ;; Query time: 932 msec ;; SERVER: 192.168.102.1#53(192.168.102.1) ;; WHEN: Wed Dec 22 22:01:24 2004 ;; MSG SIZE rcvd: 281 |
Пример 14.13. Утилита dig |
Закрыть окно |