/l3/users/14-06-2010/nt-lnet/debian4.net.nt/root :1 :2 :3 :4 :5 :6 :7 :8 :9 :10 :11 :12 :13 :14 |
|
#iptables -L -v
Chain INPUT (policy ACCEPT 11 packets, 869 bytes) pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 121 packets, 41194 bytes) pkts bytes target prot opt in out source destination 0 0 ACCEPT all -- any any default default |
#iptables -L -v
Chain INPUT (policy ACCEPT 11 packets, 869 bytes) pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 134 packets, 43449 bytes) pkts bytes target prot opt in out source destination 0 0 ACCEPT all -- any any default default |
#iptables -L -v
Chain INPUT (policy ACCEPT 11 packets, 869 bytes) pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 146 packets, 44241 bytes) pkts bytes target prot opt in out source destination 0 0 ACCEPT all -- any any default default |
#iptables -L -v
Chain INPUT (policy ACCEPT 11 packets, 869 bytes) pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 158 packets, 45033 bytes) pkts bytes target prot opt in out source destination 0 0 ACCEPT all -- any any default default |
#iptables -L -v
Chain INPUT (policy ACCEPT 11 packets, 869 bytes) pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 172 packets, 48751 bytes) pkts bytes target prot opt in out source destination 0 0 ACCEPT all -- any any default default |
#iptables -L -v
Chain INPUT (policy ACCEPT 11 packets, 869 bytes) pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 197 packets, 51672 bytes) pkts bytes target prot opt in out source destination 0 0 ACCEPT all -- any any default default |
#iptables -L -v
Chain INPUT (policy ACCEPT 11 packets, 869 bytes) pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 209 packets, 52464 bytes) pkts bytes target prot opt in out source destination 0 0 ACCEPT all -- any any default default |
#iptables -L -v
Chain INPUT (policy ACCEPT 11 packets, 869 bytes) pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 221 packets, 53256 bytes) pkts bytes target prot opt in out source destination 0 0 ACCEPT all -- any any default default |
#iptables -L -v --line-numbers
Chain INPUT (policy ACCEPT 14 packets, 1051 bytes) num pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 278 packets, 86139 bytes) num pkts bytes target prot opt in out source destination 1 0 0 ACCEPT all -- any any default default |
#iptables -L -v --line-numbers
Chain INPUT (policy ACCEPT 15 packets, 1109 bytes) num pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 296 packets, 95721 bytes) num pkts bytes target prot opt in out source destination 1 0 0 ACCEPT all -- any any default default |
#iptables -D OUTPUT -s 0.0.0.0 -d 0.0.0.0 -j ACCEPT
|
#iptables -L -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 18 packets, 1062 bytes) num pkts bytes target prot opt in out source destination 1 0 0 ACCEPT all -- any any anywhere default |
#iptables -L -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 24 packets, 1458 bytes) num pkts bytes target prot opt in out source destination 1 0 0 ACCEPT all -- any any anywhere default |
#iptables -L -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 30 packets, 1854 bytes) num pkts bytes target prot opt in out source destination 1 0 0 ACCEPT all -- any any anywhere default |
#iptables -L -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 36 packets, 2250 bytes) num pkts bytes target prot opt in out source destination 1 0 0 ACCEPT all -- any any anywhere default |
#iptables -L -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 42 packets, 2646 bytes) num pkts bytes target prot opt in out source destination 1 0 0 ACCEPT all -- any any anywhere default |
#iptables -L -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 48 packets, 3042 bytes) num pkts bytes target prot opt in out source destination 1 0 0 ACCEPT all -- any any anywhere default |
#iptables -L -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 54 packets, 3438 bytes) num pkts bytes target prot opt in out source destination 1 0 0 ACCEPT all -- any any anywhere default |
#iptables -L -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 60 packets, 3834 bytes) num pkts bytes target prot opt in out source destination 1 0 0 ACCEPT all -- any any anywhere default |
#iptables -L -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 66 packets, 4230 bytes) num pkts bytes target prot opt in out source destination 1 0 0 ACCEPT all -- any any anywhere default |
#iptables -D OUTPUT -s 0.0.0.0 -d 0.0.0.0 -j ACCEPT
![]() iptables: Bad rule (does a matching rule exist in that chain?). |
#iptables -D OUTPUT -d 0.0.0.0 -j ACCEPT
|
#iptables -L -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination 1 0 0 ACCEPT all -- any any anywhere anywhere |
#iptables -L -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination 1 0 0 ACCEPT all -- any any anywhere anywhere |
#iptables -L -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination 1 0 0 ACCEPT all -- any any anywhere anywhere |
#iptables -L -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination 1 0 0 ACCEPT all -- any any anywhere anywhere |
#iptables -L -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination 1 0 0 ACCEPT all -- any any anywhere anywhere |
#iptables -L -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination 1 0 0 ACCEPT all -- any any anywhere anywhere |
#iptables -L -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination 1 0 0 ACCEPT all -- any any anywhere anywhere |
#iptables -L -v --line-numbers
Chain INPUT (policy ACCEPT 29 packets, 1702 bytes) num pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination 1 17 36911 ACCEPT all -- any any anywhere anywhere |
#iptables -L -v --line-numbers
Chain INPUT (policy ACCEPT 29 packets, 1702 bytes) num pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination 1 17 36911 ACCEPT all -- any any anywhere anywhere |
#iptables -L -v --line-numbers
Chain INPUT (policy ACCEPT 29 packets, 1702 bytes) num pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination 1 17 36911 ACCEPT all -- any any anywhere anywhere |
#iptables -L -v --line-numbers
Chain INPUT (policy ACCEPT 29 packets, 1702 bytes) num pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain OUTPUT (policy DROP 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination 1 17 36911 ACCEPT all -- any any anywhere anywhere |
#iptables -t nat -L -n
Chain PREROUTING (policy ACCEPT) target prot opt source destination Chain POSTROUTING (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination |
#iptables -L -n
Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy DROP) target prot opt source destination ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 |
#iptables -L
Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy DROP) target prot opt source destination ACCEPT all -- anywhere anywhere |
#bg
[1]+ tcpdump -i eth0 -n -p icmp & 10:41:53.287540 IP 192.168.16.24 > 192.168.16.4: ICMP echo request, id 10193, seq 9, length 64 |
#10:41:54.297593 IP 192.168.16.24 > 192.168.16.4: ICMP echo request, id 10193, seq 10, length 64
|
#10:41:55.307701 IP 192.168.16.24 > 192.168.16.4: ICMP echo request, id 10193, seq 11, length 64
|
#10:41:59.347642 IP 192.168.16.24 > 192.168.16.4: ICMP echo request, id 10193, seq 15, length 64
jo10:42:00.357761 IP 192.168.16.24 > 192.168.16.4: ICMP echo request, id 10193, seq 16, length 64 bs [1]+ Running tcpdump -i eth0 -n -p icmp & |
#10:42:01.367587 IP 192.168.16.24 > 192.168.16.4: ICMP echo request, id 10193, seq 17, length 64
10:42:02.377663 IP 192.168.16.24 > 192.168.16.4: ICMP echo request, id 10193, seq 18, length 64 10:42:03.387866 IP 192.168.16.24 > 192.168.16.4: ICMP echo request, id 10193, seq 19, length 64 fg 1 tcpdump -i eth0 -n -p icmp 10:42:04.397693 IP 192.168.16.24 > 192.168.16.4: ICMP echo request, id 10193, seq 20, length 64 ^C 21 packets captured 21 packets received by filter 0 packets dropped by kernel |
#iptables -t filter -R 1 INPUT -p icmp -s 192.168.16.24 -j REJECT
![]() iptables v1.4.6: Invalid rule number `INPUT' Try `iptables -h' or 'iptables --help' for more information. |
#iptables -t filter -R 1 -p icmp -s 192.168.16.24 -j REJECT
![]() iptables v1.4.6: -R requires a rule number Try `iptables -h' or 'iptables --help' for more information. |
#iptables -t filter -R INPUT 1 -p icmp -s 192.168.16.24 -j REJECT
|
#man iptables
|
#man iptables
![]() |
#netstat -lnp
Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:110 0.0.0.0:* LISTEN 1950/popa3d tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN 6033/perl tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1000/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2593/exim4 tcp 0 0 0.0.0.0:65534 0.0.0.0:* LISTEN 4845/xinetd tcp6 0 0 :::5900 :::* LISTEN 1026/Xvnc tcp6 0 0 :::22 :::* LISTEN 1000/sshd tcp6 0 0 ::1:25 :::* LISTEN 2593/exim4 udp 0 0 0.0.0.0:10000 0.0.0.0:* 6033/perl Active UNIX domain sockets (only servers) Proto RefCnt Flags Type State I-Node PID/Program name Path unix 2 [ ACC ] STREAM LISTENING 2588 1077/gnome-keyring- /tmp/keyring-ljZs3L/socket unix 2 [ ACC ] STREAM LISTENING 2382 985/dbus-daemon /var/run/dbus/system_bus_socket unix 2 [ ACC ] STREAM LISTENING 2813 1195/dbus-daemon @/tmp/dbus-gbXyyvwoOE unix 2 [ ACC ] STREAM LISTENING 2799 1191/ssh-agent /tmp/ssh-WfUKnd1152/agent.1152 unix 2 [ ACC ] STREAM LISTENING 2430 1011/gdm /var/run/gdm_socket unix 2 [ ACC ] STREAM LISTENING 2872 1224/gconfd-2 /tmp/orbit-user/linc-4c8-0-2abf4729e80a8 unix 2 [ ACC ] STREAM LISTENING 2889 1219/firefox-bin /tmp/orbit-user/linc-4c3-0-7d37809017e2 unix 2 [ ACC ] STREAM LISTENING 2475 1026/Xvnc /tmp/.X11-unix/X0 |
#iptables -t filter -L
Chain INPUT (policy ACCEPT) target prot opt source destination REJECT icmp -- fbsd4.net.nt anywhere reject-with icmp-admin-prohibited Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy DROP) target prot opt source destination ACCEPT all -- anywhere anywhere |
#iptables -t filter -A INPUT --dport 110 -s 192.168.16.24 -j DROP
![]() iptables v1.4.6: unknown option `--dport' Try `iptables -h' or 'iptables --help' for more information. |
#iptables -t filter -A INPUT --d-port 110 -s 192.168.16.24 -j DROP
![]() iptables v1.4.6: unknown option `--d-port' Try `iptables -h' or 'iptables --help' for more information. |
#iptables -t filter -A INPUT -p tcp --dport 110 -s 192.168.16.24 -j DROP
|
#iptables -t filter -A INPUT -p udp --dport 110 -s 192.168.16.24 -j DROP
|
#man iptables
|
#vim /etc/protocols
|
#Updated from http://www.iana.org/assignments/protocol-numbers and other
|
#iptables -t filter -L
Chain INPUT (policy ACCEPT) target prot opt source destination REJECT icmp -- fbsd4.net.nt anywhere reject-with icmp-admin-prohibited DROP tcp -- !fbsd4.net.nt anywhere tcp dpt:pop3 DROP udp -- fbsd4.net.nt anywhere udp dpt:pop3 Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy DROP) target prot opt source destination ACCEPT all -- anywhere anywhere |
#iptables -t filter -L -n
Chain INPUT (policy ACCEPT) target prot opt source destination REJECT icmp -- 192.168.16.24 0.0.0.0/0 reject-with icmp-admin-prohibited DROP tcp -- !192.168.16.24 0.0.0.0/0 tcp dpt:110 DROP udp -- 192.168.16.24 0.0.0.0/0 udp dpt:110 Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy DROP) target prot opt source destination ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 |
#ssh 192.168.16.254
IPTABLES(8) iptables 1.4.6 IPTABLES(8) NAMEx debian 2.6.26-2-xen-686 #1 SMP Tue Mar 9 20:11:42 UTC 2010 i686 iptables — administration tool for IPv4 packet filtering and NAT SYNOPSIS iptables [-t table] {-A|-D} chain rule-specificationfree software; iptables [-t table] -I chain [rulenum] rule-specificationhe iptables [-t table] -R chain rulenum rule-specification iptables [-t table] -D chain rulenum iptables [-t table] -S [chain [rulenum]]NTY, to the extent iptables [-t table] {-F|-L|-Z} [chain [rulenum]] [options...] ... Bad argument `PREROUTING' -A PREROUTING -s 192.168.16.1 -d 192.168.16.254 -p tcp --dport 22222 -j DNAT --to-destinat Try `iptables -h' or 'iptables --help' for more information. PREROUTING -s 192.168.16.1 -d 192.168.16.254 -p tcp --dport 22222 -j DNAT --to-destinati APREROUTING -s 192.168.16.1 -d 192.168.16.254 -p tcp --dport 22222 -j DNAT --to-destinatio debian:~# .16.24:22-t nat PREROUTING -s 192.168.16.1 -d 192.168.16.254 -p tcp --dport 22222 -j DNAT --to-destinatio debian:~# debian:~# debian:~# exit logout Connection to 192.168.16.254 closed. |
#ssh 192.168.16.254 -p 22222
![]() ssh: connect to host 192.168.16.254 port 22222: Connection refused |
#nc 192.168.16.254 22222
![]() (UNKNOWN) [192.168.16.254] 22222 (?) : Connection refused |
#nc 192.168.16.254 22222
![]() (UNKNOWN) [192.168.16.254] 22222 (?) : Connection refused |
#nc 192.168.16.254 22222
![]() (UNKNOWN) [192.168.16.254] 22222 (?) : Connection refused |
#nc 192.168.16.254 22222
![]() (UNKNOWN) [192.168.16.254] 22222 (?) : Connection refused |
#apt-get install rdesktop
Чтение списков пакетов... Готово Построение дерева зависимостей Чтение информации о состоянии... Готово НОВЫЕ пакеты, которые будут установлены: rdesktop обновлено 0, установлено 1 новых пакетов, для удаления отмечено 0 пакетов, и 345 пакетов не обновлено. Необходимо скачать 133kБ архивов. После данной операции, объём занятого дискового пространства возрастёт на 475kB. Получено:1 http://debian.org.ua squeeze/main rdesktop 1.6.0-3 [133kB] Получено 133kБ за 0с (581kБ/c) Выбор ранее не выбранного пакета rdesktop. (Чтение базы данных ... на данный момент установлено 72218 файлов и каталогов.) Распаковывается пакет rdesktop (из файла .../rdesktop_1.6.0-3_i386.deb)... Обрабатываются триггеры для man-db ... Настраивается пакет rdesktop (1.6.0-3) ... |
#cat /tmp/ipta
# Generated by iptables-save v1.4.6 on Wed Jun 16 11:03:43 2010 *nat :PREROUTING ACCEPT [4982:407345] :POSTROUTING ACCEPT [1628:103141] :OUTPUT ACCEPT [2252:140293] COMMIT # Completed on Wed Jun 16 11:03:43 2010 # Generated by iptables-save v1.4.6 on Wed Jun 16 11:03:43 2010 *mangle :PREROUTING ACCEPT [1360330:95507131] ... *filter :INPUT ACCEPT [33089:2514657] :FORWARD ACCEPT [0:0] :OUTPUT DROP [0:0] -A INPUT -s 192.168.16.24/32 -p icmp -j REJECT --reject-with icmp-admin-prohibited -A INPUT ! -s 192.168.16.24/32 -p tcp -m tcp --dport 110 -j DROP -A INPUT -s 192.168.16.24/32 -p udp -m udp --dport 110 -j DROP -A OUTPUT -j ACCEPT COMMIT # Completed on Wed Jun 16 11:03:43 2010 |
#vim /tmp/ipta
|
#~
14 :POSTROUTING ACCEPT [1526476:3549773418] 15 COMMIT" 27L, 926C 16 # Completed on Wed Jun 16 11:03:43 2010 17 # Generated by iptables-save v1.4.6 on Wed Jun 16 11:03:43 2010 18 *filter 19 :INPUT ACCEPT [33089:2514657] 20 :FORWARD ACCEPT [0:0] 21 :OUTPUT DROP [0:0] 22 -A INPUT -s 192.168.16.24/32 -p icmp -j REJECT --reject-with icmp-admin-prohibited 23 -A INPUT ! -s 192.168.16.24/32 -p tcp -m tcp --dport 110 -j DROP 24 -A INPUT -s 192.168.16.24/32 -p udp -m udp --dport 110 -j DROP 25 -A OUTPUT -j ACCEPT 26 COMMIT 27 # Completed on Wed Jun 16 11:03:43 2010 |
#~
IPTABLES(8) iptables 1.4.6 IPTABLES(8) NAME iptables — administration tool for IPv4 packet filtering and NAT NAME SYNOPSIS iptables [-t table] {-A|-D} chain rule-specificationtering and NAT iptables [-t table] -I chain [rulenum] rule-specification iptables [-t table] -R chain rulenum rule-specification iptables [-t table] -D chain rulenumle-specification iptables [-t table] -S [chain [rulenum]] ... nels (>= 2.6.11-rc1) don't have the ability to NAT to multiple ranges anymore. --random If option --random is used then port mapping will be randomized (kernel >= 2.6.21). --persistent Gives a client the same source-/destination-address for each connection. This supersedes the SAME target. Support for persistent mappings is available from 2.6.29-rc2. TCPMSS This target allows to alter the MSS value of TCP SYN packets, to control the maximum size for that con‐ nection (usually limiting it to your outgoing interface's MTU minus 40 for IPv4 or 60 for IPv6, respec‐ tively). Of course, it can only be used in conjunction with -p tcp. It is only valid in the mangle ta‐ |
#man iptables
|
#man iptables
|
#ipt
iptables iptables-apply iptables-multi iptables-restore iptables-save iptunnel |
#iptables -L
Chain INPUT (policy ACCEPT) target prot opt source destination REJECT icmp -- fbsd4.net.nt anywhere reject-with icmp-admin-prohibited DROP tcp -- !fbsd4.net.nt anywhere tcp dpt:pop3 DROP udp -- fbsd4.net.nt anywhere udp dpt:pop3 Chain FORWARD (policy ACCEPT) target prot opt source destination DROP tcp -- 192.168.0.0/24 192.168.16.0/24 tcp dpt:pop3 Chain OUTPUT (policy DROP) target prot opt source destination ACCEPT all -- anywhere anywhere |
#iptables -L -n
Chain INPUT (policy ACCEPT) target prot opt source destination REJECT icmp -- 192.168.16.24 0.0.0.0/0 reject-with icmp-admin-prohibited DROP tcp -- !192.168.16.24 0.0.0.0/0 tcp dpt:110 DROP udp -- 192.168.16.24 0.0.0.0/0 udp dpt:110 Chain FORWARD (policy ACCEPT) target prot opt source destination DROP tcp -- 192.168.0.0/24 192.168.16.0/24 tcp dpt:110 Chain OUTPUT (policy DROP) target prot opt source destination ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 |
#iptables -n -S
![]() iptables v1.4.6: Illegal option `-n' with this command Try `iptables -h' or 'iptables --help' for more information. |
#iptables -S
-P INPUT ACCEPT -P FORWARD ACCEPT -P OUTPUT DROP -A INPUT -s 192.168.16.24/32 -p icmp -j REJECT --reject-with icmp-admin-prohibited -A INPUT ! -s 192.168.16.24/32 -p tcp -m tcp --dport 110 -j DROP -A INPUT -s 192.168.16.24/32 -p udp -m udp --dport 110 -j DROP -A FORWARD -s 192.168.0.0/24 -d 192.168.16.0/24 -p tcp -m tcp --dport 110 -j DROP -A OUTPUT -j ACCEPT |
#iptables -D 4
![]() iptables: Bad rule (does a matching rule exist in that chain?). |
#iptables -L -n
Chain INPUT (policy ACCEPT) target prot opt source destination REJECT icmp -- 192.168.16.24 0.0.0.0/0 reject-with icmp-admin-prohibited DROP tcp -- !192.168.16.24 0.0.0.0/0 tcp dpt:110 DROP udp -- 192.168.16.24 0.0.0.0/0 udp dpt:110 Chain FORWARD (policy ACCEPT) target prot opt source destination DROP tcp -- 192.168.0.0/24 192.168.16.0/24 tcp dpt:110 Chain OUTPUT (policy DROP) target prot opt source destination ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 |
#iptables -D 1
![]() iptables: Bad rule (does a matching rule exist in that chain?). |
#iptables -R INPUT
![]() iptables v1.4.6: -R requires a rule number Try `iptables -h' or 'iptables --help' for more information. |
#iptables -R INPUT 1
|
#iptables -L -n
Chain INPUT (policy ACCEPT) target prot opt source destination all -- 0.0.0.0/0 0.0.0.0/0 DROP tcp -- !192.168.16.24 0.0.0.0/0 tcp dpt:110 DROP udp -- 192.168.16.24 0.0.0.0/0 udp dpt:110 Chain FORWARD (policy ACCEPT) target prot opt source destination DROP tcp -- 192.168.0.0/24 192.168.16.0/24 tcp dpt:110 Chain OUTPUT (policy DROP) target prot opt source destination ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 |
#iptables -D INPUT 1
|
#iptables -L -n
Chain INPUT (policy ACCEPT) target prot opt source destination DROP tcp -- !192.168.16.24 0.0.0.0/0 tcp dpt:110 DROP udp -- 192.168.16.24 0.0.0.0/0 udp dpt:110 Chain FORWARD (policy ACCEPT) target prot opt source destination DROP tcp -- 192.168.0.0/24 192.168.16.0/24 tcp dpt:110 Chain OUTPUT (policy DROP) target prot opt source destination ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 |
#iptables -F INPUT
|
#iptables -L -n
Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination DROP tcp -- 192.168.0.0/24 192.168.16.0/24 tcp dpt:110 Chain OUTPUT (policy DROP) target prot opt source destination ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 |
#iptables -F OUTPUT
|
#tc
![]() |
#L
![]() man iptables CT --reject-with icmp-admin-prohibitedR INPUT 1 -p icmp -s 192.168.16.24 -j REJEC |
#1 -p icmp -s 192.168.16.24 -j REJECT
|
#vim /etc/protocols
![]() |
#tc
![]() |
#L
![]() man iptables CT --reject-with icmp-admin-prohibitedR INPUT 1 -p icmp -s 192.168.16.24 -j REJEC |
#1 -p icmp -s 192.168.16.24 -j REJECT
|
#iptables -t filter -P OUTPUT ALLO
![]() iptables: Bad policy name. Run `dmesg' for more information. |
#w
13:02:19 up 1 day, 3:11, 4 users, load average: 0,00, 0,00, 0,00 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT user console :0 Tue09 27:11m 0.00s 29.22s fluxbox user pts/3 :0:S.1 Tue16 39:48 0.44s 0.20s ssh 192.168.16. root hvc0 13:01 0.00s 0.04s 0.00s script -f -c l3 user pts/7 :0:S.2 10:53 8:48 0.28s 0.20s /bin/bash |
#iptables -t filter -P OUTPUT ALLOW
![]() iptables: Bad policy name. Run `dmesg' for more information. |
#iptables -t filter -P OUTPUT ACCEP
![]() iptables: Bad policy name. Run `dmesg' for more information. |
#iptables -t filter -P OUTPUT ACCEPT
|
# Generated by iptables-save v1.4.6 on Wed Jun 16 11:03:43 2010 *nat :PREROUTING ACCEPT [4982:407345] :POSTROUTING ACCEPT [1628:103141] :OUTPUT ACCEPT [2252:140293] COMMIT # Completed on Wed Jun 16 11:03:43 2010 # Generated by iptables-save v1.4.6 on Wed Jun 16 11:03:43 2010 *mangle :PREROUTING ACCEPT [1360330:95507131] :INPUT ACCEPT [1358921:95363999] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [1527300:3550097874] :POSTROUTING ACCEPT [1526476:3549773418] COMMIT # Completed on Wed Jun 16 11:03:43 2010 # Generated by iptables-save v1.4.6 on Wed Jun 16 11:03:43 2010 *filter :INPUT ACCEPT [33089:2514657] :FORWARD ACCEPT [0:0] :OUTPUT DROP [0:0] -A INPUT -s 192.168.16.24/32 -p icmp -j REJECT --reject-with icmp-admin-prohibited -A INPUT ! -s 192.168.16.24/32 -p tcp -m tcp --dport 110 -j DROP -A INPUT -s 192.168.16.24/32 -p udp -m udp --dport 110 -j DROP -A OUTPUT -j ACCEPT COMMIT # Completed on Wed Jun 16 11:03:43 2010
Время первой команды журнала | 09:36:04 2010- 6-16 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Время последней команды журнала | 12:02:26 2010- 6-16 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Количество командных строк в журнале | 101 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Процент команд с ненулевым кодом завершения, % | 19.80 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Процент синтаксически неверно набранных команд, % | 0.99 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Суммарное время работы с терминалом *, час | 1.48 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Количество командных строк в единицу времени, команда/мин | 1.14 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Частота использования команд |
|
В журнал автоматически попадают все команды, данные в любом терминале системы.
Для того чтобы убедиться, что журнал на текущем терминале ведётся, и команды записываются, дайте команду w. В поле WHAT, соответствующем текущему терминалу, должна быть указана программа script.
Команды, при наборе которых были допущены синтаксические ошибки, выводятся перечёркнутым текстом:
$ l s-l bash: l: command not found |
Если код завершения команды равен нулю, команда была выполнена без ошибок. Команды, код завершения которых отличен от нуля, выделяются цветом.
$ test 5 -lt 4 |
Команды, ход выполнения которых был прерван пользователем, выделяются цветом.
$ find / -name abc find: /home/devi-orig/.gnome2: Keine Berechtigung find: /home/devi-orig/.gnome2_private: Keine Berechtigung find: /home/devi-orig/.nautilus/metafiles: Keine Berechtigung find: /home/devi-orig/.metacity: Keine Berechtigung find: /home/devi-orig/.inkscape: Keine Berechtigung ^C |
Команды, выполненные с привилегиями суперпользователя, выделяются слева красной чертой.
# id uid=0(root) gid=0(root) Gruppen=0(root) |
Изменения, внесённые в текстовый файл с помощью редактора, запоминаются и показываются в журнале в формате ed. Строки, начинающиеся символом "<", удалены, а строки, начинающиеся символом ">" -- добавлены.
$ vi ~/.bashrc
|
Для того чтобы изменить файл в соответствии с показанными в диффшоте изменениями, можно воспользоваться командой patch. Нужно скопировать изменения, запустить программу patch, указав в качестве её аргумента файл, к которому применяются изменения, и всавить скопированный текст:
$ patch ~/.bashrc |
Для того чтобы получить краткую справочную информацию о команде, нужно подвести к ней мышь. Во всплывающей подсказке появится краткое описание команды.
Если справочная информация о команде есть, команда выделяется голубым фоном, например: vi. Если справочная информация отсутствует, команда выделяется розовым фоном, например: notepad.exe. Справочная информация может отсутствовать в том случае, если (1) команда введена неверно; (2) если распознавание команды LiLaLo выполнено неверно; (3) если информация о команде неизвестна LiLaLo. Последнее возможно для редких команд.
Большие, в особенности многострочные, всплывающие подсказки лучше всего показываются браузерами KDE Konqueror, Apple Safari и Microsoft Internet Explorer. В браузерах Mozilla и Firefox они отображаются не полностью, а вместо перевода строки выводится специальный символ.
Время ввода команды, показанное в журнале, соответствует времени начала ввода командной строки, которое равно тому моменту, когда на терминале появилось приглашение интерпретатора
Имя терминала, на котором была введена команда, показано в специальном блоке. Этот блок показывается только в том случае, если терминал текущей команды отличается от терминала предыдущей.
Вывод не интересующих вас в настоящий момент элементов журнала, таких как время, имя терминала и других, можно отключить. Для этого нужно воспользоваться формой управления журналом вверху страницы.
Небольшие комментарии к командам можно вставлять прямо из командной строки. Комментарий вводится прямо в командную строку, после символов #^ или #v. Символы ^ и v показывают направление выбора команды, к которой относится комментарий: ^ - к предыдущей, v - к следующей. Например, если в командной строке было введено:
$ whoami
user
$ #^ Интересно, кто я?в журнале это будет выглядеть так:
$ whoami
user
Интересно, кто я? |
Если комментарий содержит несколько строк, его можно вставить в журнал следующим образом:
$ whoami
user
$ cat > /dev/null #^ Интересно, кто я?
Программа whoami выводит имя пользователя, под которым мы зарегистрировались в системе. - Она не может ответить на вопрос о нашем назначении в этом мире.В журнале это будет выглядеть так:
$ whoami user
|
Комментарии, не относящиеся непосредственно ни к какой из команд, добавляются точно таким же способом, только вместо симолов #^ или #v нужно использовать символы #=
1 2 3 4Группы команд, выполненных на разных терминалах, разделяются специальной линией. Под этой линией в правом углу показано имя терминала, на котором выполнялись команды. Для того чтобы посмотреть команды только одного сенса, нужно щёкнуть по этому названию.
LiLaLo (L3) расшифровывается как Live Lab Log.
Программа разработана для повышения эффективности обучения Unix/Linux-системам.
(c) Игорь Чубин, 2004-2008