免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: nettx
打印 上一主题 下一主题

[网络管理] 【讨论】iptables中的疑难 [复制链接]

论坛徽章:
1
白银圣斗士
日期:2015-11-23 08:33:04
41 [报告]
发表于 2007-05-20 16:39 |只看该作者
原帖由 tree2008 于 2007-5-20 15:32 发表于 39楼  



:em11: 他们在忽悠你呢,忽悠,就会忽悠,除了忽悠还是忽悠啊,没点实质的东西。

你这种测试的态度很好,不过方法还可以优化一下
“iptables -P OUTPUT DROP后啥都死了”,如果你OUTPUT链没有任何ACC ...


呵呵,唉.我无话可说了.

我只相信事实,他们有没有忽悠我,我心里很清楚啦......

我实在不明白,你可以不可以这样测试,OUTPUT键不加任何规则,然后在iptables -P OUTPUT DROP

然后你看看你的内网的机器还能不能通外网!!
srun 该用户已被删除
42 [报告]
发表于 2007-05-20 17:55 |只看该作者
提示: 作者被禁止或删除 内容自动屏蔽

论坛徽章:
0
43 [报告]
发表于 2007-05-20 18:02 |只看该作者
原帖由 枫影谁用了 于 2007-5-20 16:39 发表于 41楼  


呵呵,唉.我无话可说了.

我只相信事实,他们有没有忽悠我,我心里很清楚啦......

我实在不明白,你可以不可以这样测试,OUTPUT键不加任何规则,然后在iptables -P OUTPUT DROP

然后你看看你的内网的机器 ...



当然也可以按你这样测试啊,只是这样测日志里没有记录,也就是说没有铁证而已.
呵呵,我们做SA讲的就是证据(而不是随便说点"我做了个实验证明了XX","回去好好看书","直接间接"之类来忽悠别人),而证据在99%情况下就是LOG

[ 本帖最后由 tree2008 于 2007-5-20 18:18 编辑 ]

论坛徽章:
0
44 [报告]
发表于 2007-05-20 18:03 |只看该作者
原帖由 srun 于 2007-5-20 17:55 发表于 42楼  
真理往往掌握在少数人手里,所以少数人的见解就是真理,这就是新一代的孺子哲学。



这话我爱听

论坛徽章:
1
白银圣斗士
日期:2015-11-23 08:33:04
45 [报告]
发表于 2007-05-20 18:36 |只看该作者
呵呵,你这么认为就这么认为吧.

好在我一开始就没有跟你摩擦...

======================
天要下雨,娘要嫁人...随他吧..

论坛徽章:
5
IT运维版块每日发帖之星
日期:2015-08-06 06:20:00IT运维版块每日发帖之星
日期:2015-08-10 06:20:00IT运维版块每日发帖之星
日期:2015-08-23 06:20:00IT运维版块每日发帖之星
日期:2015-08-24 06:20:00IT运维版块每日发帖之星
日期:2015-11-12 06:20:00
46 [报告]
发表于 2007-05-20 20:09 |只看该作者
按照你们的测试在OUTPUT链加了DROP规则后,机器不能PING通外网了。有这么一种可能,如果在该机器上开了某服务譬如DNS转发(干脆说就是CACHE DNS服务器),而客户机的DNS恰好是该机器,那么此时如果在OUTPUT链加DROP,就会出现PING不通的现象。因为最起码域名无法解析了。这通过对OUTPUT链的DROP就间接控制了上网,但不能说转发的数据走OUTPUT链。当然这只是我的一种猜测。

最后,请大家在说出结果前,帖出自己的实验环境,特别是配置文件。这样才有说服力。顺便刷好自己的牙,当然也包括我。

论坛徽章:
5
IT运维版块每日发帖之星
日期:2015-08-06 06:20:00IT运维版块每日发帖之星
日期:2015-08-10 06:20:00IT运维版块每日发帖之星
日期:2015-08-23 06:20:00IT运维版块每日发帖之星
日期:2015-08-24 06:20:00IT运维版块每日发帖之星
日期:2015-11-12 06:20:00
47 [报告]
发表于 2007-05-20 20:39 |只看该作者
下面我帖出我的实验配置及结果:
环境如下:
一台装有FC6的IBM笔记本链接到一台装有FC6的双网卡的LINUX网关的ETH0卡,网段为10.0.0.0/8。另有一台装有XP的台式计算机,链接到了该LINUX网关的ETH1卡,网段为192.168.0.0/24。
三台机器的配置分别如下:


一)笔记本:
1、网卡的IP配置:
eth0      Link encap:Ethernet  HWaddr 00:10:A4:89:86:B1  
          inet addr:10.0.0.2  Bcast:10.255.255.255  Mask:255.0.0.0
          inet6 addr: fe80::210:a4ff:fe89:86b1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:28 errors:0 dropped:0 overruns:0 frame:0
          TX packets:137 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2306 (2.2 KiB)  TX bytes:12420 (12.1 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:847 errors:0 dropped:0 overruns:0 frame:0
          TX packets:847 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1554924 (1.4 MiB)  TX bytes:1554924 (1.4 MiB)
2、路由表的配置
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.0.0        *               255.0.0.0       U     0      0        0 eth0
default         10.0.0.1        0.0.0.0         UG    0      0        0 eth0
3、没有开任何服务,没有开任何防火墙。


二)LINUX网关的配置:
1、网络部分的配置:
eth0      Link encap:Ethernet  HWaddr 00:05:01:01:01:12  
          inet addr:10.0.0.1  Bcast:10.255.255.255  Mask:255.0.0.0
          inet6 addr: fe80::205:1ff:fe01:112/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:147 errors:0 dropped:0 overruns:0 frame:0
          TX packets:45 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:13607 (13.2 KiB)  TX bytes:3776 (3.6 KiB)
          Interrupt:12 Base address:0xe000

eth1      Link encap:Ethernet  HWaddr 00:05:01:01:01:10  
          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::205:1ff:fe01:110/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:154 errors:0 dropped:0 overruns:0 frame:0
          TX packets:154 errors:0 dropped:0 overruns:0 carrier:0
          collisions:12 txqueuelen:1000
          RX bytes:14959 (14.6 KiB)  TX bytes:14152 (13.8 KiB)
          Interrupt:5 Base address:0xc000

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:13 errors:0 dropped:0 overruns:0 frame:0
          TX packets:13 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1388 (1.3 KiB)  TX bytes:1388 (1.3 KiB)

2、路由表的配置
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     *               255.255.255.0   U     0      0        0 eth1
169.254.0.0     *               255.255.0.0     U     0      0        0 eth1
10.0.0.0        *               255.0.0.0       U     0      0        0 eth0
3、IPTABLES的配置
# Generated by iptables-save v1.3.5 on Mon May 21 04:26:25 2007
*filter
:INPUT ACCEPT [54:4380]
:FORWARD ACCEPT [42:3398]
:OUTPUT ACCEPT [0:0]
-A OUTPUT -j DROP
COMMIT
# Completed on Mon May 21 04:26:25 2007
4、该机器没有开任何其他的服务,当然打开了转发。

三、另一台XP机器的配置
1、网络部分的配置:
Windows IP Configuration

        Host Name . . . . . . . . . . . . : bzd
        Primary Dns Suffix  . . . . . . . :
        Node Type . . . . . . . . . . . . : Unknown
        IP Routing Enabled. . . . . . . . : No
        WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter 本地连接:

        Connection-specific DNS Suffix  . :
        Description . . . . . . . . . . . : Realtek RTL8139 Famil
rnet NIC
        Physical Address. . . . . . . . . : 00-E0-4C-E2-9D-03
        Dhcp Enabled. . . . . . . . . . . : Yes
        Autoconfiguration Enabled . . . . : Yes
        IP Address. . . . . . . . . . . . : 192.168.0.88
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . : 192.168.0.254
        DHCP Server . . . . . . . . . . . : 192.168.0.254
        DNS Servers . . . . . . . . . . . : 192.168.0.254
        Lease Obtained. . . . . . . . . . : 2007年5月20日 19:31:5
        Lease Expires . . . . . . . . . . : 2007年5月21日 1:31:56
2、路由表的配置
C:\Documents and Settings\admin>route print
===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x2 ...00 e0 4c e2 9d 03 ...... Realtek RTL8139 Family PCI Fast Ethernet NIC -
数据包计划程序微型端口
===========================================================================
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0    192.168.0.254    192.168.0.88       30
         10.0.0.0        255.0.0.0      192.168.0.1    192.168.0.88       1
        127.0.0.0        255.0.0.0        127.0.0.1       127.0.0.1       1
      192.168.0.0    255.255.255.0     192.168.0.88    192.168.0.88       30
     192.168.0.88  255.255.255.255        127.0.0.1       127.0.0.1       30
    192.168.0.255  255.255.255.255     192.168.0.88    192.168.0.88       30
        224.0.0.0        240.0.0.0     192.168.0.88    192.168.0.88       30
  255.255.255.255  255.255.255.255     192.168.0.88    192.168.0.88       1
Default Gateway:     192.168.0.254
===========================================================================
Persistent Routes:
  None
3、没有防火墙。正在上CU论坛。

四)结果:
1、XP机器PING IBM笔记本
C:\Documents and Settings\admin>ping 10.0.0.2

Pinging 10.0.0.2 with 32 bytes of data:

Reply from 10.0.0.2: bytes=32 time=5ms TTL=63
Reply from 10.0.0.2: bytes=32 time=1ms TTL=63
Reply from 10.0.0.2: bytes=32 time<1ms TTL=63
Reply from 10.0.0.2: bytes=32 time=1ms TTL=63

Ping statistics for 10.0.0.2:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 5ms, Average = 1ms

2、IBM笔记本PING XP的机器:
PING 192.168.0.88 (192.168.0.8 56(84) bytes of data.
64 bytes from 192.168.0.88: icmp_seq=1 ttl=127 time=4.82 ms
64 bytes from 192.168.0.88: icmp_seq=2 ttl=127 time=1.75 ms
64 bytes from 192.168.0.88: icmp_seq=3 ttl=127 time=0.570 ms
64 bytes from 192.168.0.88: icmp_seq=4 ttl=127 time=1.72 ms
64 bytes from 192.168.0.88: icmp_seq=5 ttl=127 time=0.560 ms
64 bytes from 192.168.0.88: icmp_seq=6 ttl=127 time=2.78 ms
64 bytes from 192.168.0.88: icmp_seq=7 ttl=127 time=1.72 ms
64 bytes from 192.168.0.88: icmp_seq=8 ttl=127 time=0.938 ms

五)结论:
我不能在说结论了,大家自己看把。

论坛徽章:
5
IT运维版块每日发帖之星
日期:2015-08-06 06:20:00IT运维版块每日发帖之星
日期:2015-08-10 06:20:00IT运维版块每日发帖之星
日期:2015-08-23 06:20:00IT运维版块每日发帖之星
日期:2015-08-24 06:20:00IT运维版块每日发帖之星
日期:2015-11-12 06:20:00
48 [报告]
发表于 2007-05-20 20:42 |只看该作者
下面我帖出我的实验配置及结果:
环境如下:
一台装有FC6的IBM笔记本链接到一台装有FC6的双网卡的LINUX网关的ETH0卡,网段为10.0.0.0/8。另有一台装有XP的台式计算机,链接到了该LINUX网关的ETH1卡,网段为192.168.0.0/24。
三台机器的配置分别如下:


一)笔记本:
1、网卡的IP配置:
eth0      Link encap:Ethernet  HWaddr 00:10:A4:89:86:B1  
          inet addr:10.0.0.2  Bcast:10.255.255.255  Mask:255.0.0.0
          inet6 addr: fe80::210:a4ff:fe89:86b1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:28 errors:0 dropped:0 overruns:0 frame:0
          TX packets:137 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2306 (2.2 KiB)  TX bytes:12420 (12.1 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:847 errors:0 dropped:0 overruns:0 frame:0
          TX packets:847 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1554924 (1.4 MiB)  TX bytes:1554924 (1.4 MiB)
2、路由表的配置
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.0.0        *               255.0.0.0       U     0      0        0 eth0
default         10.0.0.1        0.0.0.0         UG    0      0        0 eth0
3、没有开任何服务,没有开任何防火墙。


二)LINUX网关的配置:
1、网络部分的配置:
eth0      Link encap:Ethernet  HWaddr 00:05:01:01:01:12  
          inet addr:10.0.0.1  Bcast:10.255.255.255  Mask:255.0.0.0
          inet6 addr: fe80::205:1ff:fe01:112/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:147 errors:0 dropped:0 overruns:0 frame:0
          TX packets:45 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:13607 (13.2 KiB)  TX bytes:3776 (3.6 KiB)
          Interrupt:12 Base address:0xe000

eth1      Link encap:Ethernet  HWaddr 00:05:01:01:01:10  
          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::205:1ff:fe01:110/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:154 errors:0 dropped:0 overruns:0 frame:0
          TX packets:154 errors:0 dropped:0 overruns:0 carrier:0
          collisions:12 txqueuelen:1000
          RX bytes:14959 (14.6 KiB)  TX bytes:14152 (13.8 KiB)
          Interrupt:5 Base address:0xc000

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:13 errors:0 dropped:0 overruns:0 frame:0
          TX packets:13 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1388 (1.3 KiB)  TX bytes:1388 (1.3 KiB)

2、路由表的配置
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     *               255.255.255.0   U     0      0        0 eth1
169.254.0.0     *               255.255.0.0     U     0      0        0 eth1
10.0.0.0        *               255.0.0.0       U     0      0        0 eth0
3、IPTABLES的配置
# Generated by iptables-save v1.3.5 on Mon May 21 04:26:25 2007
*filter
:INPUT ACCEPT [54:4380]
:FORWARD ACCEPT [42:3398]
:OUTPUT ACCEPT [0:0]
-A OUTPUT -j DROP
COMMIT
# Completed on Mon May 21 04:26:25 2007
4、该机器没有开任何其他的服务,当然打开了转发。

三、另一台XP机器的配置
1、网络部分的配置:
Windows IP Configuration

        Host Name . . . . . . . . . . . . : bzd
        Primary Dns Suffix  . . . . . . . :
        Node Type . . . . . . . . . . . . : Unknown
        IP Routing Enabled. . . . . . . . : No
        WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter 本地连接:

        Connection-specific DNS Suffix  . :
        Description . . . . . . . . . . . : Realtek RTL8139 Famil
rnet NIC
        Physical Address. . . . . . . . . : 00-E0-4C-E2-9D-03
        Dhcp Enabled. . . . . . . . . . . : Yes
        Autoconfiguration Enabled . . . . : Yes
        IP Address. . . . . . . . . . . . : 192.168.0.88
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . : 192.168.0.254
        DHCP Server . . . . . . . . . . . : 192.168.0.254
        DNS Servers . . . . . . . . . . . : 192.168.0.254
        Lease Obtained. . . . . . . . . . : 2007年5月20日 19:31:5
        Lease Expires . . . . . . . . . . : 2007年5月21日 1:31:56
2、路由表的配置
C:\Documents and Settings\admin>route print
===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x2 ...00 e0 4c e2 9d 03 ...... Realtek RTL8139 Family PCI Fast Ethernet NIC -
数据包计划程序微型端口
===========================================================================
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0    192.168.0.254    192.168.0.88       30
         10.0.0.0        255.0.0.0      192.168.0.1    192.168.0.88       1
        127.0.0.0        255.0.0.0        127.0.0.1       127.0.0.1       1
      192.168.0.0    255.255.255.0     192.168.0.88    192.168.0.88       30
     192.168.0.88  255.255.255.255        127.0.0.1       127.0.0.1       30
    192.168.0.255  255.255.255.255     192.168.0.88    192.168.0.88       30
        224.0.0.0        240.0.0.0     192.168.0.88    192.168.0.88       30
  255.255.255.255  255.255.255.255     192.168.0.88    192.168.0.88       1
Default Gateway:     192.168.0.254
===========================================================================
Persistent Routes:
  None
3、没有防火墙。正在上CU论坛。

四)结果:
1、XP机器PING IBM笔记本
C:\Documents and Settings\admin>ping 10.0.0.2

Pinging 10.0.0.2 with 32 bytes of data:

Reply from 10.0.0.2: bytes=32 time=5ms TTL=63
Reply from 10.0.0.2: bytes=32 time=1ms TTL=63
Reply from 10.0.0.2: bytes=32 time<1ms TTL=63
Reply from 10.0.0.2: bytes=32 time=1ms TTL=63

Ping statistics for 10.0.0.2:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 5ms, Average = 1ms

2、IBM笔记本PING XP的机器:
PING 192.168.0.88 (192.168.0.8 56(84) bytes of data.
64 bytes from 192.168.0.88: icmp_seq=1 ttl=127 time=4.82 ms
64 bytes from 192.168.0.88: icmp_seq=2 ttl=127 time=1.75 ms
64 bytes from 192.168.0.88: icmp_seq=3 ttl=127 time=0.570 ms
64 bytes from 192.168.0.88: icmp_seq=4 ttl=127 time=1.72 ms
64 bytes from 192.168.0.88: icmp_seq=5 ttl=127 time=0.560 ms
64 bytes from 192.168.0.88: icmp_seq=6 ttl=127 time=2.78 ms
64 bytes from 192.168.0.88: icmp_seq=7 ttl=127 time=1.72 ms
64 bytes from 192.168.0.88: icmp_seq=8 ttl=127 time=0.938 ms

五)结论:
我不能在说结论了,大家自己看把。

论坛徽章:
0
49 [报告]
发表于 2007-05-20 23:03 |只看该作者
原帖由 ssffzz1 于 2007-5-20 20:42 发表于 48楼  
下面我帖出我的实验配置及结果:
环境如下:
一台装有FC6的IBM笔记本链接到一台装有FC6的双网卡的LINUX网关的ETH0卡,网段为10.0.0.0/8。另有一台装有XP的台式计算机,链接到了该LINUX网关的ETH1卡,网段为19 ...


业余,实在业余!
你自己看看你自己的配置WIN XP机器
               IP:        192.168.0.88
Default Gateway . . . . . . . . . : 192.168.0.254


网关居然是192.168.0.254
而你的FC6的Linux的eth0 :10.0.0.1
                              eth1:192.168.0.1

你从192.168.0.88ping 10.0.0.2通过的是网关是192.168.0.254,而你的防火墙部署在192.168.0.1,如果192.168.0.254没防火墙,或者防火墙规则允许的话,那当然能ping通。


以后造假也要造得像点样,别这样让人一看就出破绽

论坛徽章:
0
50 [报告]
发表于 2007-05-20 23:10 |只看该作者
原帖由 tree2008 于 2007-5-20 23:03 发表于 49楼  


你就不用繼續吵了。

iptables -P OUTPUT DROP 後,這個不影響內部透過 nat 連出去的主機。

透過 nat 出去的主機,主要是 PREROUTING (nat) --> FORWARD (filer table) --> POSTROUTING (nat),所以不會走到 OUTPUT (filter) 上。

既然你的觀念不對,應該學會虛心接受,而不是繼續凹下去。

--
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP