/l3/users/17-12-2012/NT-Lnet/debian1.net.nt/root :1 :2 :3 :4 :5 :6 :7 :8 :9 |
|
#host ya.ru
ya.ru has address 93.158.134.203 ya.ru has address 213.180.193.3 ya.ru has address 213.180.204.3 ya.ru has address 77.88.21.3 ya.ru has address 87.250.250.3 ya.ru has address 87.250.250.203 ya.ru has address 87.250.251.3 ya.ru has address 93.158.134.3 ya.ru mail is handled by 10 mx.yandex.ru. |
#ping ya.ru
PING ya.ru (93.158.134.3) 56(84) bytes of data. 64 bytes from www.yandex.ru (93.158.134.3): icmp_req=1 ttl=58 time=18.1 ms 64 bytes from www.yandex.ru (93.158.134.3): icmp_req=2 ttl=58 time=19.7 ms ^C --- ya.ru ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1001ms rtt min/avg/max/mdev = 18.163/18.932/19.702/0.781 ms |
#vim /etc/resolv.conf
--- /dev/null 2012-12-17 19:01:14.436000008 +0200 +++ iptables 2012-12-18 16:46:17.000000000 +0200 @@ -0,0 +1,2 @@ +#!/bin/bash +iptables-restore < /etc/iptables.rule |
#~
search net.nt nameserver 192.168.13.253 "/etc/resolv.conf" 2L, 40C |
#~
Chain PREROUTING (policy ACCEPT) target prot opt source destination Chain INPUT (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination Chain POSTROUTING (policy ACCEPT) target prot opt source destination |
#man iptables
|
#cd /etc/network/if-up.d/
|
#ls -hl
итого 12K -rwxr-xr-x 1 root root 4,5K Мар 28 2012 mountnfs -rwxr-xr-x 1 root root 849 Дек 21 2009 openssh-server |
#cd ..
|
#cd if-down.d/
|
#ls -hl
итого 0 |
#vim iptables
![]() |
#cd ..
|
#cd if-up.d/
|
#ls -hl
итого 12K -rwxr-xr-x 1 root root 4,5K Мар 28 2012 mountnfs -rwxr-xr-x 1 root root 849 Дек 21 2009 openssh-server |
#vim iptables
![]() |
#ls -hl
итого 16K -rw-r--r-- 1 root root 50 Дек 18 16:46 iptables -rwxr-xr-x 1 root root 4,5K Мар 28 2012 mountnfs -rwxr-xr-x 1 root root 849 Дек 21 2009 openssh-server |
#chmod +x iptables
|
#ls -hl
итого 16K -rwxr-xr-x 1 root root 50 Дек 18 16:46 iptables -rwxr-xr-x 1 root root 4,5K Мар 28 2012 mountnfs -rwxr-xr-x 1 root root 849 Дек 21 2009 openssh-server |
#cd ..
|
#cd if-down.d/
|
#ls -hl
итого 4,0K -rw-r--r-- 1 root root 47 Дек 18 16:45 iptables |
#chmod +x iptables
|
#ls -hl
итого 4,0K -rwxr-xr-x 1 root root 47 Дек 18 16:45 iptables |
#iptables -L
Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination |
#iptables -t nat -L
Chain PREROUTING (policy ACCEPT) target prot opt source destination Chain INPUT (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination Chain POSTROUTING (policy ACCEPT) target prot opt source destination |
#iptables -A INPUT -d 127.0.0.1 -p icmp -j DROP
|
#iptables -L
Chain INPUT (policy ACCEPT) target prot opt source destination DROP icmp -- anywhere localhost.localdomain Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination |
#ping 127.0.0.1
![]() PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data. ^C --- 127.0.0.1 ping statistics --- 4 packets transmitted, 0 received, 100% packet loss, time 3000ms |
#man iptables
|
#iptables -L -n
Chain INPUT (policy ACCEPT) target prot opt source destination DROP icmp -- 0.0.0.0/0 127.0.0.1 Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination |
#iptables -Ln
![]() iptables: No chain/target/match by that name. |
#iptables -L -n
Chain INPUT (policy ACCEPT) target prot opt source destination DROP icmp -- 0.0.0.0/0 127.0.0.1 Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination |
#iptables -L --line-numbers
Chain INPUT (policy ACCEPT) num target prot opt source destination 1 DROP icmp -- anywhere localhost.localdomain Chain FORWARD (policy ACCEPT) num target prot opt source destination Chain OUTPUT (policy ACCEPT) num target prot opt source destination |
#iptables -D INPUT 1
|
#iptables -L --line-numbers
Chain INPUT (policy ACCEPT) num target prot opt source destination Chain FORWARD (policy ACCEPT) num target prot opt source destination Chain OUTPUT (policy ACCEPT) num target prot opt source destination |
#ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data. 64 bytes from 127.0.0.1: icmp_req=1 ttl=64 time=0.040 ms 64 bytes from 127.0.0.1: icmp_req=2 ttl=64 time=0.036 ms ^C --- 127.0.0.1 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 999ms rtt min/avg/max/mdev = 0.036/0.038/0.040/0.002 ms |
#iptables -A INPUT -d 127.0.0.1 -p icmp -j DROP
|
#iptables -D INPUT -d 127.0.0.1 -p icpm -j DROP
![]() iptables v1.4.8: unknown protocol `icpm' specified Try `iptables -h' or 'iptables --help' for more information. |
#iptables -L --line-numbers
Chain INPUT (policy ACCEPT) num target prot opt source destination 1 DROP icmp -- anywhere localhost.localdomain Chain FORWARD (policy ACCEPT) num target prot opt source destination Chain OUTPUT (policy ACCEPT) num target prot opt source destination |
#iptables -D INPUT -d 127.0.0.1 -p icmp -j DROP
|
#iptables -F INPUT
|
#iptables -L --line-numbers
Chain INPUT (policy ACCEPT) num target prot opt source destination Chain FORWARD (policy ACCEPT) num target prot opt source destination Chain OUTPUT (policy ACCEPT) num target prot opt source destination |
#ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data. 64 bytes from 127.0.0.1: icmp_req=1 ttl=64 time=0.035 ms 64 bytes from 127.0.0.1: icmp_req=2 ttl=64 time=0.044 ms ^C --- 127.0.0.1 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 999ms rtt min/avg/max/mdev = 0.035/0.039/0.044/0.007 ms |
#iptables -A INPUT -p tcp --dport 80 -j ACCEPT
|
#iptables -A INPUT -p tcp --dport 22 -j ACCEPT
|
#iptables -A INPUT -p tcp --syn -j DROP
|
#iptables -L
Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT tcp -- anywhere anywhere tcp dpt:www ACCEPT tcp -- anywhere anywhere tcp dpt:ssh DROP tcp -- anywhere anywhere tcp flags:FIN,SYN,RST,ACK/SYN Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination |
#nmap localhost
Starting Nmap 5.00 ( http://nmap.org ) at 2012-12-19 09:49 EET Interesting ports on localhost.localdomain (127.0.0.1): Not shown: 998 filtered ports PORT STATE SERVICE 22/tcp open ssh 80/tcp closed http Nmap done: 1 IP address (1 host up) scanned in 6.39 seconds |
#nmap 192.168.13.1
Starting Nmap 5.00 ( http://nmap.org ) at 2012-12-19 09:50 EET Interesting ports on debian1.net.nt (192.168.13.1): Not shown: 998 filtered ports PORT STATE SERVICE 22/tcp open ssh 80/tcp closed http Nmap done: 1 IP address (1 host up) scanned in 4.91 seconds |
#iptables -L
Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT tcp -- anywhere anywhere tcp dpt:www ACCEPT tcp -- anywhere anywhere tcp dpt:ssh DROP tcp -- anywhere anywhere tcp flags:FIN,SYN,RST,ACK/SYN Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination |
#nmap 192.168.13.1
Starting Nmap 5.00 ( http://nmap.org ) at 2012-12-19 09:52 EET Interesting ports on debian1.net.nt (192.168.13.1): Not shown: 998 filtered ports PORT STATE SERVICE 22/tcp open ssh 80/tcp closed http Nmap done: 1 IP address (1 host up) scanned in 6.39 seconds |
#nmap 192.168.13.2
Starting Nmap 5.00 ( http://nmap.org ) at 2012-12-19 09:54 EET Interesting ports on 192.168.13.2: Not shown: 998 filtered ports PORT STATE SERVICE 22/tcp open ssh 80/tcp closed http MAC Address: 00:16:3E:00:00:02 (Xensource) Nmap done: 1 IP address (1 host up) scanned in 4.70 seconds |
#netstat -nr
Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 0.0.0.0 192.168.13.253 0.0.0.0 UG 0 0 0 eth0 192.168.13.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 |