LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1204|回复: 13

linuxth以及其它玩防火墙的高手请进,我实在对shorewall没办法了,崩溃中OTZ

[复制链接]
发表于 2007-8-9 19:45:00 | 显示全部楼层 |阅读模式
本人化了三个星期时间看各种资料,把gentoo翻来覆去装了不下20遍,好不容易把该整的都整的明白了,就差最后临门一脚配置shorewall实现NAT了,却卡住了……

本来shorewall在网上的资料挺全的,我shorewall的资料看了n遍,确信不会出配置错误,而且我还用webmin来检查我配置的条目,都通过了,本以为绝对不会出问题的东西出了问题,而且还是匪夷所思的古怪问题——我卡住的问题不是客户端不能正常从NAT上网,也不是端口映射有问题,而是——启动防火墙以后它居然把自己给锁家里了……

我的症状非常奇怪,首先我是一台a64的主机,配一块sis900集成网卡,我又找了一块8139插上,从 /etc/udev/rules.d/70-persistent-net.rules里能看到sis的网卡编号是eth0,8139为eth1。首先可以肯定的是,绝无内核配置问题,我把该弄的芯片驱动全部塞进去,该搞iptables相关的东西也全塞进去了,总之这机器在没开防火墙时,以双网卡都启动,其中任何一块在设置好网关后接内网上都可以正常上网(此时内网通过一个604+宽带路由器拨号adsl出去),然后,问题是这样,首先我用的拨号软件是zhllg老大推荐的ppp,是官方手册上推荐的方法:详细的设置方法我就不多叙述了,总之,在没开防火墙前,我用这东西拨号,很轻松的就上去了,能ping到dns,能用route命令看到自己被分配的gatway,然后,启动shorewall,问题大条了……shorewall很干脆的把自己给锁住了——ping外网,完全不通,ping内网,一切正常,内网也能ping到它……此时用ifconfig,可以看到自己的pppoe拨号连接是好的,没有任何问题,route也能正常看到被分配的外网网关,但就是ping外网不通,也不能上网,shorewall停下后运行一个shorewall clear命令清除所有防火墙规则(shorewall默认会启动一种叫routestop的功能,这功能是我在webmin里发现的,还没有找到禁止的方法,他的作用就是你一旦运行了shorewall,当你用shorewall stop停下时,他会默认的把iptables的策略换成堵塞所有外部进来的访问,非要clear,才能正常,不clear的话,你往外ping正常,别人ping不到你),ok了,又能ping到外网dns服务器了……
我现在是怎么也想不明白到底哪里做错了,因为我完全是理解了shorewall的配置策略后才动手的,又有webmin帮我检查是否有错,我把自己配置的相关设置帖在下面
我的sis900 eth0接内网,8139 eth1接外网
zones文件配置

  1. #
  2. # Shorewall version 3.2 - Zones File
  3. #
  4. # /etc/shorewall/zones
  5. #
  6. #        This file declares your network zones. You specify the hosts in
  7. #        each zone through entries in /etc/shorewall/interfaces or
  8. #        /etc/shorewall/hosts.
  9. #
  10. #        WARNING: The format of this file changed in Shorewall 3.0.0. You can
  11. #                 continue to use your old records provided that you set
  12. #                 IPSECFILE=ipsec in /etc/shorewall/shorewall.conf. This will
  13. #                 signal Shorewall that the IPSEC-related zone options are
  14. #                 still specified in /etc/shorewall/ipsec rather than in this
  15. #                 file.
  16. #
  17. #                 To use records in the format described below, you must have
  18. #                 IPSECFILE=zones specified in /etc/shorewall/shorewall.conf
  19. #                 AND YOU MUST NOT SET THE 'FW' VARIABLE IN THAT FILE!!!!!
  20. #
  21. # Columns are:
  22. #
  23. #        ZONE        Short name of the zone (5 Characters or less in length).
  24. #                The names "all" and "none" are reserved and may not be
  25. #                used as zone names.
  26. #
  27. #                Where a zone is nested in one or more other zones,
  28. #                you may follow the (sub)zone name by ":" and a
  29. #                comma-separated list of the parent zones. The parent
  30. #                zones must have been defined in earlier records in this
  31. #                file.
  32. #
  33. #                Example:
  34. #
  35. #                        #ZONE     TYPE     OPTIONS
  36. #                        a          ipv4
  37. #                        b          ipv4
  38. #                        c:a,b     ipv4
  39. #
  40. #                Currently, Shorewall uses this information to reorder the
  41. #                zone list so that parent zones appear after their subzones in
  42. #                the list. The IMPLICIT_CONTINUE option in shorewall.conf can
  43. #                also create implicit CONTINUE policies to/from the subzone.
  44. #
  45. #                In the future, Shorewall may make additional use
  46. #                of nesting information.
  47. #
  48. #        TYPE        ipv4 -        This is the standard Shorewall zone type and is the
  49. #                        default if you leave this column empty or if you enter
  50. #                        "-" in the column. Communication with some zone hosts
  51. #                        may be encrypted. Encrypted hosts are designated using
  52. #                        the 'ipsec'option in /etc/shorewall/hosts.
  53. #                ipsec -        Communication with all zone hosts is encrypted
  54. #                        Your kernel and iptables must include policy
  55. #                        match support.
  56. #                firewall
  57. #                      - Designates the firewall itself. You must have
  58. #                        exactly one 'firewall' zone. No options are
  59. #                        permitted with a 'firewall' zone. The name that you
  60. #                        enter in the ZONE column will be stored in the shell
  61. #                        variable $FW which you may use in other configuration
  62. #                        files to designate the firewall zone.
  63. #
  64. #        OPTIONS,        A comma-separated list of options as follows:
  65. #        IN OPTIONS,
  66. #        OUT OPTIONS        reqid=<number> where <number> is specified
  67. #                        using setkey(8) using the 'unique:<number>
  68. #                        option for the SPD level.
  69. #
  70. #                        spi=<number> where <number> is the SPI of
  71. #                        the SA used to encrypt/decrypt packets.
  72. #
  73. #                        proto=ah|esp|ipcomp
  74. #
  75. #                        mss=<number> (sets the MSS field in TCP packets)
  76. #
  77. #                        mode=transport|tunnel
  78. #
  79. #                        tunnel-src=<address>[/<mask>] (only
  80. #                        available with mode=tunnel)
  81. #
  82. #                        tunnel-dst=<address>[/<mask>] (only
  83. #                        available with mode=tunnel)
  84. #
  85. #                        strict        Means that packets must match all rules.
  86. #
  87. #                        next        Separates rules; can only be used with
  88. #                                strict
  89. #
  90. #                Example:
  91. #                        mode=transport,reqid=44
  92. #
  93. #        The options in the OPTIONS column are applied to both incoming
  94. #        and outgoing traffic. The IN OPTIONS are applied to incoming
  95. #        traffic (in addition to OPTIONS) and the OUT OPTIONS are
  96. #        applied to outgoing traffic.
  97. #
  98. #        If you wish to leave a column empty but need to make an entry
  99. #        in a following column, use "-".
  100. #------------------------------------------------------------------------------
  101. # Example zones:
  102. #
  103. #        You have a three interface firewall with internet, local and DMZ
  104. #        interfaces.
  105. #
  106. #        #ZONE        TYPE                OPTIONS                IN                        OUT
  107. #        #                                        OPTIONS                        OPTIONS
  108. #        fw        firewall
  109. #        net        ipv4
  110. #        loc        ipv4
  111. #        dmz        ipv4
  112. #
  113. #
  114. # For more information, see http://www.shorewall.net/Documentation.htm#Zones
  115. #
  116. ###############################################################################
  117. #ZONE        TYPE                OPTIONS                IN                        OUT
  118. #                                        OPTIONS                        OPTIONS
  119. fw        firewall
  120. net        ipv4
  121. lan        ipv4
  122. #LAST LINE - ADD YOUR ENTRIES ABOVE THIS ONE - DO NOT REMOVE
复制代码


Interfaces文件配置
  1. #
  2. # Shorewall version 3.2 - Interfaces File
  3. #
  4. # /etc/shorewall/interfaces
  5. #
  6. #        You must add an entry in this file for each network interface on your
  7. #        firewall system.
  8. #
  9. # Columns are:
  10. #
  11. #        ZONE                Zone for this interface. Must match the name of a
  12. #                        zone defined in /etc/shorewall/zones. You may not
  13. #                        list the firewall zone in this column.
  14. #
  15. #                        If the interface serves multiple zones that will be
  16. #                        defined in the /etc/shorewall/hosts file, you should
  17. #                        place "-" in this column.
  18. #
  19. #                        If there are multiple interfaces to the same zone,
  20. #                        you must list them in separate entries:
  21. #
  22. #                        Example:
  23. #
  24. #                                loc        eth1        -
  25. #                                loc        eth2        -
  26. #
  27. #        INTERFACE        Name of interface. Each interface may be listed only
  28. #                        once in this file. You may NOT specify the name of
  29. #                        an alias (e.g., eth0:0) here; see
  30. #                        http://www.shorewall.net/FAQ.htm#faq18
  31. #
  32. #                        You may specify wildcards here. For example, if you
  33. #                        want to make an entry that applies to all PPP
  34. #                        interfaces, use 'ppp+'.
  35. #
  36. #                        There is no need to define the loopback        interface (lo)
  37. #                        in this file.
  38. #
  39. #        BROADCAST        The broadcast address for the subnetwork to which the
  40. #                        interface belongs. For P-T-P interfaces, this
  41. #                        column is left blank.If the interface has multiple
  42. #                        addresses on multiple subnets then list the broadcast
  43. #                        addresses as a comma-separated list.
  44. #
  45. #                        If you use the special value "detect", Shorewall
  46. #                        will detect the broadcast address(es) for you. If you
  47. #                        select this option, the interface must be up before
  48. #                        the firewall is started.
  49. #
  50. #                        If you don't want to give a value for this column but
  51. #                        you want to enter a value in the OPTIONS column, enter
  52. #                        "-" in this column.
  53. #
  54. #        OPTIONS                A comma-separated list of options including the
  55. #                        following:
  56. #
  57. #                        dhcp             - Specify this option when any of
  58. #                                       the following are true:
  59. #                                       1. the interface gets its IP address
  60. #                                          via DHCP
  61. #                                       2. the interface is used by
  62. #                                          a DHCP server running on the firewall
  63. #                                       3. you have a static IP but are on a LAN
  64. #                                          segment with lots of Laptop DHCP
  65. #                                          clients.
  66. #                                       4. the interface is a bridge with
  67. #                                          a DHCP server on one port and DHCP
  68. #                                          clients on another port.
  69. #
  70. #                        norfc1918    - This interface should not receive
  71. #                                       any packets whose source is in one
  72. #                                       of the ranges reserved by RFC 1918
  73. #                                       (i.e., private or "non-routable"
  74. #                                       addresses). If packet mangling or
  75. #                                       connection-tracking match is enabled in
  76. #                                       your kernel, packets whose destination
  77. #                                       addresses are reserved by RFC 1918 are
  78. #                                       also rejected.
  79. #
  80. #                        routefilter  - turn on kernel route filtering for this
  81. #                                       interface (anti-spoofing measure). This
  82. #                                       option can also be enabled globally in
  83. #                                       the /etc/shorewall/shorewall.conf file.
  84. #
  85. #                        logmartians  - turn on kernel martian logging (logging
  86. #                                       of packets with impossible source
  87. #                                       addresses. It is suggested that if you
  88. #                                       set routefilter on an interface that
  89. #                                       you also set logmartians. This option
  90. #                                       may also be enabled globally in the
  91. #                                       /etc/shorewall/shorewall.conf file.
  92. #
  93. #                        blacklist    - Check packets arriving on this interface
  94. #                                       against the /etc/shorewall/blacklist
  95. #                                       file.
  96. #
  97. #                        maclist             - Connection requests from this interface
  98. #                                       are compared against the contents of
  99. #                                       /etc/shorewall/maclist. If this option
  100. #                                       is specified, the interface must be
  101. #                                       an ethernet NIC and must be up before
  102. #                                       Shorewall is started.
  103. #
  104. #                        tcpflags     - Packets arriving on this interface are
  105. #                                       checked for certain illegal combinations
  106. #                                       of TCP flags. Packets found to have
  107. #                                       such a combination of flags are handled
  108. #                                       according to the setting of
  109. #                                       TCP_FLAGS_DISPOSITION after having been
  110. #                                       logged according to the setting of
  111. #                                       TCP_FLAGS_LOG_LEVEL.
  112. #
  113. #                        proxyarp     -
  114. #                                Sets
  115. #                                /proc/sys/net/ipv4/conf/<interface>/proxy_arp.
  116. #                                Do NOT use this option if you are
  117. #                                employing Proxy ARP through entries in
  118. #                                /etc/shorewall/proxyarp. This option is
  119. #                                intended soley for use with Proxy ARP
  120. #                                sub-networking as described at:
  121. #                                http://www.tldp.org/HOWTO/mini/Proxy-ARP-Subnet
  122. #
  123. #                        routeback    - If specified, indicates that Shorewall
  124. #                                       should include rules that allow
  125. #                                       filtering traffic arriving on this
  126. #                                       interface back out that same interface.
  127. #
  128. #                        arp_filter   - If specified, this interface will only
  129. #                                       respond to ARP who-has requests for IP
  130. #                                       addresses configured on the interface.
  131. #                                       If not specified, the interface can
  132. #                                       respond to ARP who-has requests for
  133. #                                       IP addresses on any of the firewall's
  134. #                                       interface. The interface must be up
  135. #                                       when Shorewall is started.
  136. #
  137. #                        arp_ignore[=<number>]
  138. #                                     - If specified, this interface will
  139. #                                       respond to arp requests based on the
  140. #                                       value of <number>.
  141. #
  142. #                                       1 - reply only if the target IP address
  143. #                                       is local address configured on the
  144. #                                       incoming interface
  145. #
  146. #                                       2 - reply only if the target IP address
  147. #                                       is local address configured on the
  148. #                                       incoming interface and both with the
  149. #                                       sender's IP address are part from same
  150. #                                       subnet on this interface
  151. #
  152. #                                       3 - do not reply for local addresses
  153. #                                       configured with scope host, only
  154. #                                       resolutions for global and link
  155. #                                       addresses are replied
  156. #
  157. #                                       4-7 - reserved
  158. #
  159. #                                       8 - do not reply for all local
  160. #                                       addresses
  161. #
  162. #                                       If no <number> is given then the value
  163. #                                       1 is assumed
  164. #
  165. #                                       WARNING -- DO NOT SPECIFY arp_ignore
  166. #                                       FOR ANY INTERFACE INVOLVED IN PROXY ARP.
  167. #
  168. #                        nosmurfs     - Filter packets for smurfs
  169. #                                       (packets with a broadcast
  170. #                                       address as the source).
  171. #
  172. #                                       Smurfs will be optionally logged based
  173. #                                       on the setting of SMURF_LOG_LEVEL in
  174. #                                       shorewall.conf. After logging, the
  175. #                                       packets are dropped.
  176. #
  177. #                        detectnets   - Automatically taylors the zone named
  178. #                                       in the ZONE column to include only those
  179. #                                       hosts routed through the interface.
  180. #
  181. #                        sourceroute  - If this option is not specified for an
  182. #                                       interface, then source-routed packets
  183. #                                       will not be accepted from that
  184. #                                       interface (sets /proc/sys/net/ipv4/
  185. #                                       conf/<interface>/
  186. #                                       accept_source_route to 1).
  187. #                                       Only set this option if you know what
  188. #                                       you are you doing. This might represent
  189. #                                       a security risk and is not usually
  190. #                                       needed.
  191. #
  192. #                        upnp             - Incoming requests from this interface
  193. #                                       may be remapped via UPNP (upnpd).
  194. #
  195. #                        WARNING: DO NOT SET THE detectnets OPTION ON YOUR
  196. #                                 INTERNET INTERFACE.
  197. #
  198. #                        The order in which you list the options is not
  199. #                        significant but the list should have no embedded white
  200. #                        space.
  201. #
  202. #        Example 1:        Suppose you have eth0 connected to a DSL modem and
  203. #                        eth1 connected to your local network and that your
  204. #                        local subnet is 192.168.1.0/24. The interface gets
  205. #                        it's IP address via DHCP from subnet
  206. #                        206.191.149.192/27. You have a DMZ with subnet
  207. #                        192.168.2.0/24 using eth2.
  208. #
  209. #                        Your entries for this setup would look like:
  210. #
  211. #                        net        eth0        206.191.149.223        dhcp
  212. #                        local        eth1        192.168.1.255
  213. #                        dmz        eth2        192.168.2.255
  214. #
  215. #        Example 2:        The same configuration without specifying broadcast
  216. #                        addresses is:
  217. #
  218. #                        net        eth0        detect                dhcp
  219. #                        loc        eth1        detect
  220. #                        dmz        eth2        detect
  221. #
  222. #        Example 3:        You have a simple dial-in system with no ethernet
  223. #                        connections.
  224. #
  225. #                        net        ppp0        -
  226. #
  227. # For additional information, see
  228. # http://shorewall.net/Documentation.htm#Interfaces
  229. #
  230. ###############################################################################
  231. #ZONE        INTERFACE        BROADCAST        OPTIONS
  232. net        eth1
  233. lan        eth0
  234. #LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE
复制代码

Policy配置
  1. #
  2. # Shorewall version 3.2 - Policy File
  3. #
  4. # /etc/shorewall/policy
  5. #
  6. #                     THE ORDER OF ENTRIES IN THIS FILE IS IMPORTANT
  7. #
  8. #        This file determines what to do with a new connection request if we
  9. #        don't get a match from the /etc/shorewall/rules file . For each
  10. #        source/destination pair, the file is processed in order until a
  11. #        match is found ("all" will match any client or server).
  12. #
  13. #                        INTRA-ZONE POLICIES ARE PRE-DEFINED
  14. #
  15. #        For $FW and for all of the zoned defined in /etc/shorewall/zones,
  16. #        the POLICY for connections from the zone to itself is ACCEPT (with no
  17. #        logging or TCP connection rate limiting but may be overridden by an
  18. #        entry in this file. The overriding entry must be explicit (cannot use
  19. #        "all" in the SOURCE or DEST).
  20. #
  21. #       Similarly, if you have IMPLICIT_CONTINUE=Yes in shorewall.conf, then
  22. #       the implicit policy to/from any sub-zone is CONTINUE. These implicit
  23. #       CONTINUE policies may also be overridden by an explicit entry in this
  24. #       file.
  25. #
  26. # Columns are:
  27. #
  28. #        SOURCE                Source zone. Must be the name of a zone defined
  29. #                        in /etc/shorewall/zones, $FW or "all".
  30. #
  31. #        DEST                Destination zone. Must be the name of a zone defined
  32. #                        in /etc/shorewall/zones, $FW or "all"
  33. #
  34. #        POLICY                Policy if no match from the rules file is found. Must
  35. #                        be "ACCEPT", "DROP", "REJECT", "CONTINUE" or "NONE".
  36. #
  37. #                        ACCEPT                - Accept the connection
  38. #                        DROP                - Ignore the connection request
  39. #                        REJECT                - For TCP, send RST. For all other,
  40. #                                          send "port unreachable" ICMP.
  41. #                        QUEUE                - Send the request to a user-space
  42. #                                          application using the QUEUE target.
  43. #                        CONTINUE        - Pass the connection request past
  44. #                                          any other rules that it might also
  45. #                                          match (where the source or
  46. #                                          destination zone in those rules is
  47. #                                          a superset of the SOURCE or DEST
  48. #                                          in this policy).
  49. #                        NONE                - Assume that there will never be any
  50. #                                          packets from this SOURCE
  51. #                                          to this DEST. Shorewall will not set
  52. #                                          up any infrastructure to handle such
  53. #                                          packets and you may not have any
  54. #                                          rules with this SOURCE and DEST in
  55. #                                          the /etc/shorewall/rules file. If
  56. #                                          such a packet _is_ received, the
  57. #                                          result is undefined. NONE may not be
  58. #                                          used if the SOURCE or DEST columns
  59. #                                          contain the firewall zone ($FW) or
  60. #                                          "all".
  61. #
  62. #                        If this column contains ACCEPT, DROP or REJECT and a
  63. #                        corresponding common action is defined in
  64. #                        /etc/shorewall/actions (or
  65. #                        /usr/share/shorewall/actions.std) then that action
  66. #                        will be invoked before the policy named in this column
  67. #                        is enforced.
  68. #
  69. #        LOG LEVEL        If supplied, each connection handled under the default
  70. #                        POLICY is logged at that level. If not supplied, no
  71. #                        log message is generated. See syslog.conf(5) for a
  72. #                        description of log levels.
  73. #
  74. #                        Beginning with Shorewall version 1.3.12, you may
  75. #                        also specify ULOG (must be in upper case). This will
  76. #                        log to the ULOG target and sent to a separate log
  77. #                        through use of ulogd
  78. #                        (http://www.gnumonks.org/projects/ulogd).
  79. #
  80. #                        If you don't want to log but need to specify the
  81. #                        following column, place "-" here.
  82. #
  83. #        LIMIT:BURST        If passed, specifies the maximum TCP connection rate
  84. #                        and the size of an acceptable burst. If not specified,
  85. #                        TCP connections are not limited.
  86. #
  87. #        Example:
  88. #
  89. #        a) All connections from the local network to the internet are allowed
  90. #        b) All connections from the internet are ignored but logged at syslog
  91. #           level KERNEL.INFO.
  92. #        d) All other connection requests are rejected and logged at level
  93. #           KERNEL.INFO.
  94. #
  95. #        #SOURCE                DEST                POLICY                LOG
  96. #        #                                                LEVEL
  97. #        loc                net                ACCEPT
  98. #        net                all                DROP                info
  99. #        #
  100. #        # THE FOLLOWING POLICY MUST BE LAST
  101. #        #
  102. #        all                all                REJECT                info
  103. #
  104. # See http://shorewall.net/Documentation.htm#Policy for additional information.
  105. #
  106. ###############################################################################
  107. #SOURCE                DEST                POLICY                LOG                LIMIT:BURST
  108. #                                                LEVEL
  109. fw        all        ACCEPT
  110. lan        all        ACCEPT
  111. net        all        DROP
  112. all        all        REJECT
  113. #LAST LINE -- DO NOT REMOVE
复制代码

Rules文件我干脆没配置,留空为了测试方便

  1. #
  2. # Shorewall version 3.2 - Rules File
  3. #
  4. # /etc/shorewall/rules
  5. #
  6. #        Rules in this file govern connection establishment. Requests and
  7. #        responses are automatically allowed using connection tracking. For any
  8. #        particular (source,dest) pair of zones, the rules are evaluated in the
  9. #        order in which they appear in this file and the first match is the one
  10. #        that determines the disposition of the request.
  11. #
  12. #        In most places where an IP address or subnet is allowed, you
  13. #        can preceed the address/subnet with "!" (e.g., !192.168.1.0/24) to
  14. #        indicate that the rule matches all addresses except the address/subnet
  15. #        given. Notice that no white space is permitted between "!" and the
  16. #        address/subnet.
  17. #------------------------------------------------------------------------------
  18. # WARNING: If you masquerade or use SNAT from a local system to the internet,
  19. #           you cannot use an ACCEPT rule to allow traffic from the internet to
  20. #           that system. You *must* use a DNAT rule instead.
  21. #------------------------------------------------------------------------------
  22. #
  23. # The rules file is divided into sections. Each section is introduced by
  24. # a "Section Header" which is a line beginning with SECTION followed by the
  25. # section name.
  26. #
  27. # Sections are as follows and must appear in the order listed:
  28. #
  29. #        ESTABLISHED                Packets in the ESTABLISHED state are processed
  30. #                                by rules in this section.
  31. #
  32. #                                The only ACTIONs allowed in this section are
  33. #                                ACCEPT, DROP, REJECT, LOG and QUEUE
  34. #
  35. #                                There is an implicit ACCEPT rule inserted
  36. #                                at the end of this section.
  37. #
  38. #        RELATED                        Packets in the RELATED state are processed by
  39. #                                rules in this section.
  40. #
  41. #                                The only ACTIONs allowed in this section are
  42. #                                ACCEPT, DROP, REJECT, LOG and QUEUE
  43. #
  44. #                                There is an implicit ACCEPT rule inserted
  45. #                                at the end of this section.
  46. #
  47. #        NEW                        Packets in the NEW and INVALID states are
  48. #                                processed by rules in this section.
  49. #
  50. # Note: If you are not familiar with Netfilter to the point where you are
  51. #        comfortable with the differences between the various connection
  52. #        tracking states, then I suggest that you omit the ESTABLISHED and
  53. #        RELATED sections and place all of your rules in the NEW section
  54. #        (That's after the line that reads SECTION NEW').
  55. #
  56. # WARNING: If you specify FASTACCEPT=Yes in shorewall.conf then the
  57. #           ESTABLISHED and RELATED sections must be empty.
  58. #
  59. # You may omit any section that you don't need. If no Section Headers appear
  60. # in the file then all rules are assumed to be in the NEW section.
  61. #
  62. # Columns are:
  63. #
  64. #        ACTION                ACCEPT, DROP, REJECT, DNAT, DNAT-, REDIRECT, CONTINUE,
  65. #                        LOG, QUEUE or an <action>.
  66. #
  67. #                                ACCEPT         -- allow the connection request
  68. #                                ACCEPT+         -- like ACCEPT but also excludes the
  69. #                                            connection from any subsequent
  70. #                                            DNAT[-] or REDIRECT[-] rules
  71. #                                NONAT         -- Excludes the connection from any
  72. #                                            subsequent DNAT[-] or REDIRECT[-]
  73. #                                            rules but doesn't generate a rule
  74. #                                            to accept the traffic.
  75. #                                DROP         -- ignore the request
  76. #                                REJECT         -- disallow the request and return an
  77. #                                            icmp-unreachable or an RST packet.
  78. #                                DNAT         -- Forward the request to another
  79. #                                            system (and optionally another
  80. #                                            port).
  81. #                                DNAT-         -- Advanced users only.
  82. #                                            Like DNAT but only generates the
  83. #                                            DNAT iptables rule and not
  84. #                                            the companion ACCEPT rule.
  85. #                                SAME         -- Similar to DNAT except that the
  86. #                                            port may not be remapped and when
  87. #                                            multiple server addresses are
  88. #                                            listed, all requests from a given
  89. #                                            remote system go to the same
  90. #                                            server.
  91. #                                SAME-         -- Advanced users only.
  92. #                                            Like SAME but only generates the
  93. #                                            NAT iptables rule and not
  94. #                                            the companion ACCEPT rule.
  95. #                                REDIRECT -- Redirect the request to a local
  96. #                                            port on the firewall.
  97. #                                REDIRECT-
  98. #                                         -- Advanced users only.
  99. #                                            Like REDIRET but only generates the
  100. #                                            REDIRECT iptables rule and not
  101. #                                            the companion ACCEPT rule.
  102. #
  103. #                                CONTINUE -- (For experts only). Do not process
  104. #                                            any of the following rules for this
  105. #                                            (source zone,destination zone). If
  106. #                                            The source and/or destination IP
  107. #                                            address falls into a zone defined
  108. #                                            later in /etc/shorewall/zones, this
  109. #                                            connection request will be passed
  110. #                                            to the rules defined for that
  111. #                                            (those) zone(s).
  112. #                                LOG         -- Simply log the packet and continue.
  113. #                                QUEUE         -- Queue the packet to a user-space
  114. #                                            application such as ftwall
  115. #                                            (http://p2pwall.sf.net).
  116. #                                <action> -- The name of an action defined in
  117. #                                            /etc/shorewall/actions or in
  118. #                                            /usr/share/shorewall/actions.std.
  119. #                                <macro>         -- The name of a macro defined in a
  120. #                                            file named macro.<macro-name>. If
  121. #                                            the macro accepts an action
  122. #                                            parameter (Look at the macro
  123. #                                            source to see if it has PARAM in
  124. #                                            the TARGET column) then the macro
  125. #                                            name is followed by "/" and the
  126. #                                            action (ACCEPT, DROP, REJECT, ...)
  127. #                                            to be substituted for the
  128. #                                            parameter. Example: FTP/ACCEPT.
  129. #
  130. #                        The ACTION may optionally be followed
  131. #                        by ":" and a syslog log level (e.g, REJECT:info or
  132. #                        DNAT:debug). This causes the packet to be
  133. #                        logged at the specified level.
  134. #
  135. #                        If the ACTION names an action defined in
  136. #                        /etc/shorewall/actions or in
  137. #                        /usr/share/shorewall/actions.std then:
  138. #
  139. #                        - If the log level is followed by "!' then all rules
  140. #                          in the action are logged at the log level.
  141. #
  142. #                        - If the log level is not followed by "!" then only
  143. #                          those rules in the action that do not specify
  144. #                          logging are logged at the specified level.
  145. #
  146. #                        - The special log level 'none!' suppresses logging
  147. #                          by the action.
  148. #
  149. #                        You may also specify ULOG (must be in upper case) as a
  150. #                        log level.This will log to the ULOG target for routing
  151. #                        to a separate log through use of ulogd
  152. #                        (http://www.gnumonks.org/projects/ulogd).
  153. #
  154. #                        Actions specifying logging may be followed by a
  155. #                        log tag (a string of alphanumeric characters)
  156. #                        are appended to the string generated by the
  157. #                        LOGPREFIX (in /etc/shorewall/shorewall.conf).
  158. #
  159. #                        Example: ACCEPT:info:ftp would include 'ftp '
  160. #                        at the end of the log prefix generated by the
  161. #                        LOGPREFIX setting.
  162. #
  163. #        SOURCE                Source hosts to which the rule applies. May be a zone
  164. #                        defined in /etc/shorewall/zones, $FW to indicate the
  165. #                        firewall itself, "all", "all+", "all-", "all+-" or
  166. #                        "none".
  167. #
  168. #                        When "none" is used either in the SOURCE or DEST
  169. #                        column, the rule is ignored.
  170. #
  171. #                        "all" means "All Zones", including the firewall itself.
  172. #                        "all-" means "All Zones, except the firewall itself".
  173. #                        When "all[-]" is used either in the SOURCE or DEST
  174. #                        column intra-zone traffic is not affected. When
  175. #                        "all+[-]" is "used, intra-zone traffic is affected.
  176. #
  177. #                        Except when "all[+][-]" is specified, clients may be
  178. #                        further restricted to a list of subnets and/or hosts by
  179. #                        appending ":" and a comma-separated list of subnets
  180. #                        and/or hosts. Hosts may be specified by IP or MAC
  181. #                        address; mac addresses must begin with "~" and must use
  182. #                        "-" as a separator.
  183. #
  184. #                        Hosts may be specified as an IP address range using the
  185. #                        syntax <low address>-<high address>. This requires that
  186. #                        your kernel and iptables contain iprange match support.
  187. #                        If you kernel and iptables have ipset match support
  188. #                        then you may give the name of an ipset prefaced by "+".
  189. #                        The ipset name may be optionally followed by a number
  190. #                        from 1 to 6 enclosed in square brackets ([]) to
  191. #                        indicate the number of levels of source bindings to be
  192. #                        matched.
  193. #
  194. #                        dmz:192.168.2.2                Host 192.168.2.2 in the DMZ
  195. #
  196. #                        net:155.186.235.0/24        Subnet 155.186.235.0/24 on the
  197. #                                                Internet
  198. #
  199. #                        loc:192.168.1.1,192.168.1.2
  200. #                                                Hosts 192.168.1.1 and
  201. #                                                192.168.1.2 in the local zone.
  202. #                        loc:~00-A0-C9-15-39-78        Host in the local zone with
  203. #                                                MAC address 00:A0:C9:15:39:78.
  204. #
  205. #                        net:192.0.2.11-192.0.2.17
  206. #                                                Hosts 192.0.2.11-192.0.2.17 in
  207. #                                                the net zone.
  208. #
  209. #                        Alternatively, clients may be specified by interface
  210. #                        by appending ":" to the zone name followed by the
  211. #                        interface name. For example, loc:eth1 specifies a
  212. #                        client that communicates with the firewall system
  213. #                        through eth1. This may be optionally followed by
  214. #                        another colon (":") and an IP/MAC/subnet address
  215. #                        as described above (e.g., loc:eth1:192.168.1.5).
  216. #
  217. #        DEST                Location of Server. May be a zone defined in
  218. #                        /etc/shorewall/zones, $FW to indicate the firewall
  219. #                        itself, "all". "all+" or "none".
  220. #
  221. #                        When "none" is used either in the SOURCE or DEST
  222. #                        column, the rule is ignored.
  223. #
  224. #                        When "all" is used either in the SOURCE or DEST column
  225. #                        intra-zone traffic is not affected. When "all+" is
  226. #                        used, intra-zone traffic is affected.
  227. #
  228. #                        Except when "all[+]" is specified, the server may be
  229. #                        further restricted to a particular subnet, host or
  230. #                        interface by appending ":" and the subnet, host or
  231. #                        interface. See above.
  232. #
  233. #                                Restrictions:
  234. #
  235. #                                1. MAC addresses are not allowed.
  236. #                                2. In DNAT rules, only IP addresses are
  237. #                                   allowed; no FQDNs or subnet addresses
  238. #                                   are permitted.
  239. #                                3. You may not specify both an interface and
  240. #                                   an address.
  241. #
  242. #                        Like in the SOURCE column, you may specify a range of
  243. #                        up to 256 IP addresses using the syntax
  244. #                        <first ip>-<last ip>. When the ACTION is DNAT or DNAT-,
  245. #                        the connections will be assigned to addresses in the
  246. #                        range in a round-robin fashion.
  247. #
  248. #                        If you kernel and iptables have ipset match support
  249. #                        then you may give the name of an ipset prefaced by "+".
  250. #                        The ipset name may be optionally followed by a number
  251. #                        from 1 to 6 enclosed in square brackets ([]) to
  252. #                        indicate the number of levels of destination bindings
  253. #                        to be matched. Only one of the SOURCE and DEST columns
  254. #                        may specify an ipset name.
  255. #
  256. #                        The port that the server is listening on may be
  257. #                        included and separated from the server's IP address by
  258. #                        ":". If omitted, the firewall will not modifiy the
  259. #                        destination port. A destination port may only be
  260. #                        included if the ACTION is DNAT or REDIRECT.
  261. #
  262. #                        Example: loc:192.168.1.3:3128 specifies a local
  263. #                        server at IP address 192.168.1.3 and listening on port
  264. #                        3128. The port number MUST be specified as an integer
  265. #                        and not as a name from /etc/services.
  266. #
  267. #                        if the ACTION is REDIRECT, this column needs only to
  268. #                        contain the port number on the firewall that the
  269. #                        request should be redirected to.
  270. #
  271. #        PROTO                Protocol - Must be "tcp", "tcp:syn", "udp", "icmp",
  272. #                        "ipp2p", "ipp2p:udp", "ipp2p:all" a number, or "all".
  273. #                       "ipp2p*" requires ipp2p match support in your kernel
  274. #                       and iptables.
  275. #
  276. #                        "tcp:syn" implies "tcp" plus the SYN flag must be
  277. #                        set and the RST,ACK and FIN flags must be reset.
  278. #
  279. #        DEST PORT(S)        Destination Ports. A comma-separated list of Port
  280. #                        names (from /etc/services), port numbers or port
  281. #                        ranges; if the protocol is "icmp", this column is
  282. #                        interpreted as the destination icmp-type(s).
  283. #
  284. #                        If the protocol is ipp2p, this column is interpreted
  285. #                        as an ipp2p option without the leading "--" (example
  286. #                        "bit" for bit-torrent). If no port is given, "ipp2p" is
  287. #                        assumed.
  288. #
  289. #                        A port range is expressed as <low port>:<high port>.
  290. #
  291. #                        This column is ignored if PROTOCOL = all but must be
  292. #                        entered if any of the following ields are supplied.
  293. #                        In that case, it is suggested that this field contain
  294. #                         "-"
  295. #
  296. #                        If your kernel contains multi-port match support, then
  297. #                        only a single Netfilter rule will be generated if in
  298. #                        this list and the CLIENT PORT(S) list below:
  299. #                        1. There are 15 or less ports listed.
  300. #                        2. No port ranges are included.
  301. #                        Otherwise, a separate rule will be generated for each
  302. #                        port.
  303. #
  304. #        SOURCE PORT(S)        (Optional) Port(s) used by the client. If omitted,
  305. #                        any source port is acceptable. Specified as a comma-
  306. #                        separated list of port names, port numbers or port
  307. #                        ranges.
  308. #
  309. #                        If you don't want to restrict client ports but need to
  310. #                        specify an ORIGINAL DEST in the next column, then
  311. #                        place "-" in this column.
  312. #
  313. #                        If your kernel contains multi-port match support, then
  314. #                        only a single Netfilter rule will be generated if in
  315. #                        this list and the DEST PORT(S) list above:
  316. #                        1. There are 15 or less ports listed.
  317. #                        2. No port ranges are included.
  318. #                        Otherwise, a separate rule will be generated for each
  319. #                        port.
  320. #
  321. #        ORIGINAL DEST        (0ptional) -- If ACTION is DNAT[-] or REDIRECT[-]
  322. #                        then if included and different from the IP
  323. #                        address given in the SERVER column, this is an address
  324. #                        on some interface on the firewall and connections to
  325. #                        that address will be forwarded to the IP and port
  326. #                        specified in the DEST column.
  327. #
  328. #                        A comma-separated list of addresses may also be used.
  329. #                        This is usually most useful with the REDIRECT target
  330. #                        where you want to redirect traffic destined for
  331. #                        particular set of hosts.
  332. #
  333. #                        Finally, if the list of addresses begins with "!" then
  334. #                        the rule will be followed only if the original
  335. #                        destination address in the connection request does not
  336. #                        match any of the addresses listed.
  337. #
  338. #                        For other actions, this column may be included and may
  339. #                        contain one or more addresses (host or network)
  340. #                        separated by commas. Address ranges are not allowed.
  341. #                        When this column is supplied, rules are generated
  342. #                        that require that the original destination address
  343. #                        matches one of the listed addresses. This feature is
  344. #                        most useful when you want to generate a filter rule
  345. #                        that corresponds to a DNAT- or REDIRECT- rule. In this
  346. #                        usage, the list of addresses should not begin with "!".
  347. #
  348. #                        See http://shorewall.net/PortKnocking.html for an
  349. #                        example of using an entry in this column with a
  350. #                        user-defined action rule.
  351. #
  352. #        RATE LIMIT        You may rate-limit the rule by placing a value in
  353. #                        this colume:
  354. #
  355. #                                <rate>/<interval>[:<burst>]
  356. #
  357. #                        where <rate> is the number of connections per
  358. #                        <interval> ("sec" or "min") and <burst> is the
  359. #                        largest burst permitted. If no <burst> is given,
  360. #                        a value of 5 is assumed. There may be no
  361. #                        no whitespace embedded in the specification.
  362. #
  363. #                                Example: 10/sec:20
  364. #
  365. #        USER/GROUP        This column may only be non-empty if the SOURCE is
  366. #                        the firewall itself.
  367. #
  368. #                        The column may contain:
  369. #
  370. #        [!][<user name or number>][:<group name or number>][+<program name>]
  371. #
  372. #                        When this column is non-empty, the rule applies only
  373. #                        if the program generating the output is running under
  374. #                        the effective <user> and/or <group> specified (or is
  375. #                        NOT running under that id if "!" is given).
  376. #
  377. #                        Examples:
  378. #
  379. #                                joe        #program must be run by joe
  380. #                                :kids        #program must be run by a member of
  381. #                                        #the 'kids' group
  382. #                                !:kids        #program must not be run by a member
  383. #                                        #of the 'kids' group
  384. #                                +upnpd        #program named upnpd (This feature was
  385. #                                        #removed from Netfilter in kernel
  386. #                                        #version 2.6.14).
  387. #
  388. #        Example: Accept SMTP requests from the DMZ to the internet
  389. #
  390. #        #ACTION SOURCE        DEST PROTO        DEST        SOURCE        ORIGINAL
  391. #        #                                PORT        PORT(S) DEST
  392. #        ACCEPT        dmz        net          tcp        smtp
  393. #
  394. #        Example: Forward all ssh and http connection requests from the
  395. #                 internet to local system 192.168.1.3
  396. #
  397. #        #ACTION SOURCE        DEST                PROTO        DEST        SOURCE        ORIGINAL
  398. #        #                                        PORT        PORT(S) DEST
  399. #        DNAT        net        loc:192.168.1.3 tcp        ssh,http
  400. #
  401. #        Example: Forward all http connection requests from the internet
  402. #                 to local system 192.168.1.3 with a limit of 3 per second and
  403. #                 a maximum burst of 10
  404. #
  405. #        #ACTION SOURCE DEST               PROTO  DEST  SOURCE  ORIGINAL RATE
  406. #        #                                      PORT  PORT(S) DEST     LIMIT
  407. #        DNAT        net    loc:192.168.1.3 tcp    http  -            -             3/sec:10
  408. #
  409. #        Example: Redirect all locally-originating www connection requests to
  410. #                 port 3128 on the firewall (Squid running on the firewall
  411. #                 system) except when the destination address is 192.168.2.2
  412. #
  413. #        #ACTION         SOURCE        DEST          PROTO        DEST        SOURCE        ORIGINAL
  414. #        #                                PORT        PORT(S) DEST
  415. #        REDIRECT loc        3128          tcp        www         -        !192.168.2.2
  416. #
  417. #        Example: All http requests from the internet to address
  418. #                 130.252.100.69 are to be forwarded to 192.168.1.3
  419. #
  420. #        #ACTION         SOURCE        DEST                PROTO        DEST        SOURCE        ORIGINAL
  421. #        #                                        PORT        PORT(S) DEST
  422. #        DNAT          net        loc:192.168.1.3 tcp        80        -        130.252.100.69
  423. #
  424. #        Example: You want to accept SSH connections to your firewall only
  425. #                 from internet IP addresses 130.252.100.69 and 130.252.100.70
  426. #
  427. #        #ACTION         SOURCE        DEST                PROTO        DEST        SOURCE        ORIGINAL
  428. #        #                                        PORT        PORT(S) DEST
  429. #        ACCEPT         net:130.252.100.69,130.252.100.70 \
  430. #                        $FW                 tcp        22
  431. #
  432. #        Example: From the Internet, you want to connect to TCP port 2222 on
  433. #                 your firewall and have the connection forwarded to port 22
  434. #                 on local system 192.168.3.4
  435. #        #ACTION         SOURCE        DEST                        PROTO        DEST
  436. #        #                                                PORT
  437. #        DNAT         net        loc:192.168.3.4:22        tcp        2222
  438. #
  439. #############################################################################################################
  440. #ACTION        SOURCE                DEST                PROTO        DEST        SOURCE                ORIGINAL        RATE                USER/
  441. #                                                PORT(S)        PORT(S)                DEST                LIMIT                GROUP
  442. #SECTION ESTABLISHED
  443. #SECTION RELATED
  444. SECTION NEW
  445. #LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE
复制代码


Masq设置


  1. #
  2. # Shorewall version 3.2 - Masq file
  3. #
  4. # /etc/shorewall/masq
  5. #
  6. #        Use this file to define dynamic NAT (Masquerading) and to define
  7. #        Source NAT (SNAT).
  8. #
  9. #        WARNING: The entries in this file are order-sensitive. The first
  10. #        entry that matches a particular connection will be the one that
  11. #        is used.
  12. #
  13. #        WARNING: If you have more than one ISP, adding entries to this
  14. #        file will *not* force connections to go out through a particular
  15. #        ISP. You must use PREROUTING entries in /etc/shorewall/tcrules
  16. #        to do that.
  17. #
  18. # Columns are:
  19. #
  20. #        INTERFACE -- Outgoing interface. This is usually your internet
  21. #                     interface. If ADD_SNAT_ALIASES=Yes in
  22. #                     /etc/shorewall/shorewall.conf, you may add ":" and
  23. #                     a digit to indicate that you want the alias added with
  24. #                     that name (e.g., eth0:0). This will allow the alias to
  25. #                     be displayed with ifconfig. THAT IS THE ONLY USE FOR
  26. #                     THE ALIAS NAME AND IT MAY NOT APPEAR IN ANY OTHER
  27. #                     PLACE IN YOUR SHOREWALL CONFIGURATION.
  28. #
  29. #                     This may be qualified by adding the character
  30. #                     ":" followed by a destination host or subnet.
  31. #
  32. #                     If you wish to inhibit the action of ADD_SNAT_ALIASES
  33. #                     for this entry then include the ":" but omit the digit:
  34. #
  35. #                                eth0:
  36. #                                eth2::192.0.2.32/27
  37. #
  38. #                     Normally Masq/SNAT rules are evaluated after those for
  39. #                     one-to-one NAT (/etc/shorewall/nat file). If you want
  40. #                     the rule to be applied before one-to-one NAT rules,
  41. #                     prefix the interface name with "+":
  42. #
  43. #                        +eth0
  44. #                        +eth0:192.0.2.32/27
  45. #                        +eth0:2
  46. #
  47. #                     This feature should only be required if you need to
  48. #                     insert rules in this file that preempt entries in
  49. #                     /etc/shorewall/nat.
  50. #
  51. #        SUBNET -- Subnet that you wish to masquerade. You can specify this as
  52. #                  a subnet or as an interface. If you give the name of an
  53. #                  interface, the interface must be up before you start the
  54. #                  firewall (Shorewall will use your main routing table to
  55. #                  determine the appropriate subnet(s) to masquerade).
  56. #
  57. #                  In order to exclude a subset of the specified SUBNET, you
  58. #                  may append "!" and a comma-separated list of IP addresses
  59. #                  and/or subnets that you wish to exclude.
  60. #
  61. #                  Example: eth1!192.168.1.4,192.168.32.0/27
  62. #
  63. #                  In that example traffic from eth1 would be masqueraded unless
  64. #                  it came from 192.168.1.4 or 196.168.32.0/27
  65. #
  66. #        ADDRESS -- (Optional).        If you specify an address here, SNAT will be
  67. #                                used and this will be the source address. If
  68. #                                ADD_SNAT_ALIASES is set to Yes or yes in
  69. #                                /etc/shorewall/shorewall.conf then Shorewall
  70. #                                will automatically add this address to the
  71. #                                INTERFACE named in the first column.
  72. #
  73. #                                You may also specify a range of up to 256
  74. #                                IP addresses if you want the SNAT address to
  75. #                                be assigned from that range in a round-robin
  76. #                                range by connection. The range is specified by
  77. #                                <first ip in range>-<last ip in range>.
  78. #
  79. #                                Example: 206.124.146.177-206.124.146.180
  80. #
  81. #                                You may also use the special value "detect"
  82. #                                which causes Shorewall to determine the
  83. #                                IP addresses configured on the interface named
  84. #                                in the INTERFACES column and substitute them
  85. #                                in this column.
  86. #
  87. #                                Finally, you may also specify a comma-separated
  88. #                                list of ranges and/or addresses in this column.
  89. #
  90. #                                This column may not contain DNS Names.
  91. #
  92. #                                Normally, Netfilter will attempt to retain
  93. #                                the source port number. You may cause
  94. #                                netfilter to remap the source port by following
  95. #                                an address or range (if any) by ":" and
  96. #                                a port range with the format <low port>-
  97. #                                <high port>. If this is done, you must
  98. #                                specify "tcp" or "udp" in the PROTO column.
  99. #
  100. #                                Examples:
  101. #
  102. #                                        192.0.2.4:5000-6000
  103. #                                        :4000-5000
  104. #
  105. #                                You can invoke the SAME target using the
  106. #                                following in this column:
  107. #
  108. #                        SAME:[nodst:]<address-range>[,<address-range>...]
  109. #
  110. #                                The <address-ranges> may be single addresses
  111. #                                or "detect" as described above.
  112. #
  113. #                                SAME works like SNAT with the exception that
  114. #                                the same local IP address is assigned to each
  115. #                                connection from a local address to a given
  116. #                                remote address.
  117. #
  118. #                                If the 'nodst:' option is included, then the
  119. #                                same source address is used for a given
  120. #                                internal system regardless of which remote
  121. #                                system is involved.
  122. #
  123. #                                If you want to leave this column empty
  124. #                                but you need to specify the next column then
  125. #                                place a hyphen ("-") here.
  126. #
  127. #        PROTO -- (Optional)        If you wish to restrict this entry to a
  128. #                                particular protocol then enter the protocol
  129. #                                name (from /etc/protocols) or number here.
  130. #
  131. #        PORT(S) -- (Optional)        If the PROTO column specifies TCP (protocol 6)
  132. #                                or UDP (protocol 17) then you may list one
  133. #                                or more port numbers (or names from
  134. #                                /etc/services) separated by commas or you
  135. #                                may list a single port range
  136. #                                (<low port>:<high port>).
  137. #
  138. #                                Where a comma-separated list is given, your
  139. #                                kernel and iptables must have multiport match
  140. #                                support and a maximum of 15 ports may be
  141. #                                listed.
  142. #
  143. #        IPSEC -- (Optional)        If you specify a value other than "-" in this
  144. #                                column, you must be running kernel 2.6 and
  145. #                                your kernel and iptables must include policy
  146. #                                match support.
  147. #
  148. #                                Comma-separated list of options from the
  149. #                                following. Only packets that will be encrypted
  150. #                                via an SA that matches these options will have
  151. #                                their source address changed.
  152. #
  153. #                                        Yes or yes -- must be the only option
  154. #                                        listed and matches all outbound
  155. #                                        traffic that will be encrypted.
  156. #
  157. #                                        reqid=<number> where <number> is
  158. #                                        specified using setkey(8) using the
  159. #                                        'unique:<number> option for the SPD
  160. #                                        level.
  161. #
  162. #                                        spi=<number> where <number> is the
  163. #                                        SPI of the SA.
  164. #
  165. #                                        proto=ah|esp|ipcomp
  166. #
  167. #                                        mode=transport|tunnel
  168. #
  169. #                                        tunnel-src=<address>[/<mask>] (only
  170. #                                        available with mode=tunnel)
  171. #
  172. #                                        tunnel-dst=<address>[/<mask>] (only
  173. #                                        available with mode=tunnel)
  174. #
  175. #                                        strict        Means that packets must match
  176. #                                                all rules.
  177. #
  178. #                                        next        Separates rules; can only be
  179. #                                                used with strict..
  180. #
  181. #        Example 1:
  182. #
  183. #                  You have a simple masquerading setup where eth0 connects to
  184. #                  a DSL or cable modem and eth1 connects to your local network
  185. #                  with subnet 192.168.0.0/24.
  186. #
  187. #                  Your entry in the file can be either:
  188. #
  189. #                        eth0        eth1
  190. #
  191. #                  or
  192. #
  193. #                        eth0        192.168.0.0/24
  194. #
  195. #        Example 2:
  196. #
  197. #                  You add a router to your local network to connect subnet
  198. #                  192.168.1.0/24 which you also want to masquerade. You then
  199. #                  add a second entry for eth0 to this file:
  200. #
  201. #                        eth0        192.168.1.0/24
  202. #
  203. #        Example 3:
  204. #
  205. #                  You have an IPSEC tunnel through ipsec0 and you want to
  206. #                  masquerade packets coming from 192.168.1.0/24 but only if
  207. #                  these packets are destined for hosts in 10.1.1.0/24:
  208. #
  209. #                        ipsec0:10.1.1.0/24        196.168.1.0/24
  210. #
  211. #        Example 4:
  212. #
  213. #                  You want all outgoing traffic from 192.168.1.0/24 through
  214. #                  eth0 to use source address 206.124.146.176 which is NOT the
  215. #                  primary address of eth0. You want 206.124.146.176 added to
  216. #                  be added to eth0 with name eth0:0.
  217. #
  218. #                        eth0:0        192.168.1.0/24        206.124.146.176
  219. #
  220. #        Example 5:
  221. #
  222. #                 You want all outgoing SMTP traffic entering the firewall
  223. #                 on eth1 to be sent from eth0 with source IP address
  224. #                 206.124.146.177. You want all other outgoing traffic
  225. #                 from eth1 to be sent from eth0 with source IP address
  226. #                 206.124.146.176.
  227. #
  228. #                        eth0        eth1        206.124.146.177        tcp        smtp
  229. #                        eth0        eth1        206.124.146.176
  230. #
  231. #                THE ORDER OF THE ABOVE TWO RULES IS SIGNIFICANT!!!!!
  232. #
  233. # For additional information, see http://shorewall.net/Documentation.htm#Masq
  234. #
  235. ###############################################################################
  236. #INTERFACE                SUBNET                ADDRESS                PROTO        PORT(S)        IPSEC
  237. eth1     eth0
  238. #LAST LINE -- ADD YOUR ENTRIES ABOVE THIS LINE -- DO NOT REMOVE
复制代码


就是以上了,我不知道哪里出问题,于是后来为了测试,我干脆这么干,把内网的网卡eth0禁掉了,直接用一块网卡给自己构建了一个防护墙,结果问题和刚才一样,一开防火墙,立刻就ping不通外网,配置如下
zones文件
  1. #
  2. # Shorewall version 3.2 - Zones File
  3. #
  4. # /etc/shorewall/zones
  5. #
  6. #        This file declares your network zones. You specify the hosts in
  7. #        each zone through entries in /etc/shorewall/interfaces or
  8. #        /etc/shorewall/hosts.
  9. #
  10. #        WARNING: The format of this file changed in Shorewall 3.0.0. You can
  11. #                 continue to use your old records provided that you set
  12. #                 IPSECFILE=ipsec in /etc/shorewall/shorewall.conf. This will
  13. #                 signal Shorewall that the IPSEC-related zone options are
  14. #                 still specified in /etc/shorewall/ipsec rather than in this
  15. #                 file.
  16. #
  17. #                 To use records in the format described below, you must have
  18. #                 IPSECFILE=zones specified in /etc/shorewall/shorewall.conf
  19. #                 AND YOU MUST NOT SET THE 'FW' VARIABLE IN THAT FILE!!!!!
  20. #
  21. # Columns are:
  22. #
  23. #        ZONE        Short name of the zone (5 Characters or less in length).
  24. #                The names "all" and "none" are reserved and may not be
  25. #                used as zone names.
  26. #
  27. #                Where a zone is nested in one or more other zones,
  28. #                you may follow the (sub)zone name by ":" and a
  29. #                comma-separated list of the parent zones. The parent
  30. #                zones must have been defined in earlier records in this
  31. #                file.
  32. #
  33. #                Example:
  34. #
  35. #                        #ZONE     TYPE     OPTIONS
  36. #                        a          ipv4
  37. #                        b          ipv4
  38. #                        c:a,b     ipv4
  39. #
  40. #                Currently, Shorewall uses this information to reorder the
  41. #                zone list so that parent zones appear after their subzones in
  42. #                the list. The IMPLICIT_CONTINUE option in shorewall.conf can
  43. #                also create implicit CONTINUE policies to/from the subzone.
  44. #
  45. #                In the future, Shorewall may make additional use
  46. #                of nesting information.
  47. #
  48. #        TYPE        ipv4 -        This is the standard Shorewall zone type and is the
  49. #                        default if you leave this column empty or if you enter
  50. #                        "-" in the column. Communication with some zone hosts
  51. #                        may be encrypted. Encrypted hosts are designated using
  52. #                        the 'ipsec'option in /etc/shorewall/hosts.
  53. #                ipsec -        Communication with all zone hosts is encrypted
  54. #                        Your kernel and iptables must include policy
  55. #                        match support.
  56. #                firewall
  57. #                      - Designates the firewall itself. You must have
  58. #                        exactly one 'firewall' zone. No options are
  59. #                        permitted with a 'firewall' zone. The name that you
  60. #                        enter in the ZONE column will be stored in the shell
  61. #                        variable $FW which you may use in other configuration
  62. #                        files to designate the firewall zone.
  63. #
  64. #        OPTIONS,        A comma-separated list of options as follows:
  65. #        IN OPTIONS,
  66. #        OUT OPTIONS        reqid=<number> where <number> is specified
  67. #                        using setkey(8) using the 'unique:<number>
  68. #                        option for the SPD level.
  69. #
  70. #                        spi=<number> where <number> is the SPI of
  71. #                        the SA used to encrypt/decrypt packets.
  72. #
  73. #                        proto=ah|esp|ipcomp
  74. #
  75. #                        mss=<number> (sets the MSS field in TCP packets)
  76. #
  77. #                        mode=transport|tunnel
  78. #
  79. #                        tunnel-src=<address>[/<mask>] (only
  80. #                        available with mode=tunnel)
  81. #
  82. #                        tunnel-dst=<address>[/<mask>] (only
  83. #                        available with mode=tunnel)
  84. #
  85. #                        strict        Means that packets must match all rules.
  86. #
  87. #                        next        Separates rules; can only be used with
  88. #                                strict
  89. #
  90. #                Example:
  91. #                        mode=transport,reqid=44
  92. #
  93. #        The options in the OPTIONS column are applied to both incoming
  94. #        and outgoing traffic. The IN OPTIONS are applied to incoming
  95. #        traffic (in addition to OPTIONS) and the OUT OPTIONS are
  96. #        applied to outgoing traffic.
  97. #
  98. #        If you wish to leave a column empty but need to make an entry
  99. #        in a following column, use "-".
  100. #------------------------------------------------------------------------------
  101. # Example zones:
  102. #
  103. #        You have a three interface firewall with internet, local and DMZ
  104. #        interfaces.
  105. #
  106. #        #ZONE        TYPE                OPTIONS                IN                        OUT
  107. #        #                                        OPTIONS                        OPTIONS
  108. #        fw        firewall
  109. #        net        ipv4
  110. #        loc        ipv4
  111. #        dmz        ipv4
  112. #
  113. #
  114. # For more information, see http://www.shorewall.net/Documentation.htm#Zones
  115. #
  116. ###############################################################################
  117. #ZONE        TYPE                OPTIONS                IN                        OUT
  118. #                                        OPTIONS                        OPTIONS
  119. fw        firewall
  120. net        ipv4
  121. #LAST LINE - ADD YOUR ENTRIES ABOVE THIS ONE - DO NOT REMOVE
复制代码

Interfaces文件配置

  1. #
  2. # Shorewall version 3.2 - Interfaces File
  3. #
  4. # /etc/shorewall/interfaces
  5. #
  6. #        You must add an entry in this file for each network interface on your
  7. #        firewall system.
  8. #
  9. # Columns are:
  10. #
  11. #        ZONE                Zone for this interface. Must match the name of a
  12. #                        zone defined in /etc/shorewall/zones. You may not
  13. #                        list the firewall zone in this column.
  14. #
  15. #                        If the interface serves multiple zones that will be
  16. #                        defined in the /etc/shorewall/hosts file, you should
  17. #                        place "-" in this column.
  18. #
  19. #                        If there are multiple interfaces to the same zone,
  20. #                        you must list them in separate entries:
  21. #
  22. #                        Example:
  23. #
  24. #                                loc        eth1        -
  25. #                                loc        eth2        -
  26. #
  27. #        INTERFACE        Name of interface. Each interface may be listed only
  28. #                        once in this file. You may NOT specify the name of
  29. #                        an alias (e.g., eth0:0) here; see
  30. #                        http://www.shorewall.net/FAQ.htm#faq18
  31. #
  32. #                        You may specify wildcards here. For example, if you
  33. #                        want to make an entry that applies to all PPP
  34. #                        interfaces, use 'ppp+'.
  35. #
  36. #                        There is no need to define the loopback        interface (lo)
  37. #                        in this file.
  38. #
  39. #        BROADCAST        The broadcast address for the subnetwork to which the
  40. #                        interface belongs. For P-T-P interfaces, this
  41. #                        column is left blank.If the interface has multiple
  42. #                        addresses on multiple subnets then list the broadcast
  43. #                        addresses as a comma-separated list.
  44. #
  45. #                        If you use the special value "detect", Shorewall
  46. #                        will detect the broadcast address(es) for you. If you
  47. #                        select this option, the interface must be up before
  48. #                        the firewall is started.
  49. #
  50. #                        If you don't want to give a value for this column but
  51. #                        you want to enter a value in the OPTIONS column, enter
  52. #                        "-" in this column.
  53. #
  54. #        OPTIONS                A comma-separated list of options including the
  55. #                        following:
  56. #
  57. #                        dhcp             - Specify this option when any of
  58. #                                       the following are true:
  59. #                                       1. the interface gets its IP address
  60. #                                          via DHCP
  61. #                                       2. the interface is used by
  62. #                                          a DHCP server running on the firewall
  63. #                                       3. you have a static IP but are on a LAN
  64. #                                          segment with lots of Laptop DHCP
  65. #                                          clients.
  66. #                                       4. the interface is a bridge with
  67. #                                          a DHCP server on one port and DHCP
  68. #                                          clients on another port.
  69. #
  70. #                        norfc1918    - This interface should not receive
  71. #                                       any packets whose source is in one
  72. #                                       of the ranges reserved by RFC 1918
  73. #                                       (i.e., private or "non-routable"
  74. #                                       addresses). If packet mangling or
  75. #                                       connection-tracking match is enabled in
  76. #                                       your kernel, packets whose destination
  77. #                                       addresses are reserved by RFC 1918 are
  78. #                                       also rejected.
  79. #
  80. #                        routefilter  - turn on kernel route filtering for this
  81. #                                       interface (anti-spoofing measure). This
  82. #                                       option can also be enabled globally in
  83. #                                       the /etc/shorewall/shorewall.conf file.
  84. #
  85. #                        logmartians  - turn on kernel martian logging (logging
  86. #                                       of packets with impossible source
  87. #                                       addresses. It is suggested that if you
  88. #                                       set routefilter on an interface that
  89. #                                       you also set logmartians. This option
  90. #                                       may also be enabled globally in the
  91. #                                       /etc/shorewall/shorewall.conf file.
  92. #
  93. #                        blacklist    - Check packets arriving on this interface
  94. #                                       against the /etc/shorewall/blacklist
  95. #                                       file.
  96. #
  97. #                        maclist             - Connection requests from this interface
  98. #                                       are compared against the contents of
  99. #                                       /etc/shorewall/maclist. If this option
  100. #                                       is specified, the interface must be
  101. #                                       an ethernet NIC and must be up before
  102. #                                       Shorewall is started.
  103. #
  104. #                        tcpflags     - Packets arriving on this interface are
  105. #                                       checked for certain illegal combinations
  106. #                                       of TCP flags. Packets found to have
  107. #                                       such a combination of flags are handled
  108. #                                       according to the setting of
  109. #                                       TCP_FLAGS_DISPOSITION after having been
  110. #                                       logged according to the setting of
  111. #                                       TCP_FLAGS_LOG_LEVEL.
  112. #
  113. #                        proxyarp     -
  114. #                                Sets
  115. #                                /proc/sys/net/ipv4/conf/<interface>/proxy_arp.
  116. #                                Do NOT use this option if you are
  117. #                                employing Proxy ARP through entries in
  118. #                                /etc/shorewall/proxyarp. This option is
  119. #                                intended soley for use with Proxy ARP
  120. #                                sub-networking as described at:
  121. #                                http://www.tldp.org/HOWTO/mini/Proxy-ARP-Subnet
  122. #
  123. #                        routeback    - If specified, indicates that Shorewall
  124. #                                       should include rules that allow
  125. #                                       filtering traffic arriving on this
  126. #                                       interface back out that same interface.
  127. #
  128. #                        arp_filter   - If specified, this interface will only
  129. #                                       respond to ARP who-has requests for IP
  130. #                                       addresses configured on the interface.
  131. #                                       If not specified, the interface can
  132. #                                       respond to ARP who-has requests for
  133. #                                       IP addresses on any of the firewall's
  134. #                                       interface. The interface must be up
  135. #                                       when Shorewall is started.
  136. #
  137. #                        arp_ignore[=<number>]
  138. #                                     - If specified, this interface will
  139. #                                       respond to arp requests based on the
  140. #                                       value of <number>.
  141. #
  142. #                                       1 - reply only if the target IP address
  143. #                                       is local address configured on the
  144. #                                       incoming interface
  145. #
  146. #                                       2 - reply only if the target IP address
  147. #                                       is local address configured on the
  148. #                                       incoming interface and both with the
  149. #                                       sender's IP address are part from same
  150. #                                       subnet on this interface
  151. #
  152. #                                       3 - do not reply for local addresses
  153. #                                       configured with scope host, only
  154. #                                       resolutions for global and link
  155. #                                       addresses are replied
  156. #
  157. #                                       4-7 - reserved
  158. #
  159. #                                       8 - do not reply for all local
  160. #                                       addresses
  161. #
  162. #                                       If no <number> is given then the value
  163. #                                       1 is assumed
  164. #
  165. #                                       WARNING -- DO NOT SPECIFY arp_ignore
  166. #                                       FOR ANY INTERFACE INVOLVED IN PROXY ARP.
  167. #
  168. #                        nosmurfs     - Filter packets for smurfs
  169. #                                       (packets with a broadcast
  170. #                                       address as the source).
  171. #
  172. #                                       Smurfs will be optionally logged based
  173. #                                       on the setting of SMURF_LOG_LEVEL in
  174. #                                       shorewall.conf. After logging, the
  175. #                                       packets are dropped.
  176. #
  177. #                        detectnets   - Automatically taylors the zone named
  178. #                                       in the ZONE column to include only those
  179. #                                       hosts routed through the interface.
  180. #
  181. #                        sourceroute  - If this option is not specified for an
  182. #                                       interface, then source-routed packets
  183. #                                       will not be accepted from that
  184. #                                       interface (sets /proc/sys/net/ipv4/
  185. #                                       conf/<interface>/
  186. #                                       accept_source_route to 1).
  187. #                                       Only set this option if you know what
  188. #                                       you are you doing. This might represent
  189. #                                       a security risk and is not usually
  190. #                                       needed.
  191. #
  192. #                        upnp             - Incoming requests from this interface
  193. #                                       may be remapped via UPNP (upnpd).
  194. #
  195. #                        WARNING: DO NOT SET THE detectnets OPTION ON YOUR
  196. #                                 INTERNET INTERFACE.
  197. #
  198. #                        The order in which you list the options is not
  199. #                        significant but the list should have no embedded white
  200. #                        space.
  201. #
  202. #        Example 1:        Suppose you have eth0 connected to a DSL modem and
  203. #                        eth1 connected to your local network and that your
  204. #                        local subnet is 192.168.1.0/24. The interface gets
  205. #                        it's IP address via DHCP from subnet
  206. #                        206.191.149.192/27. You have a DMZ with subnet
  207. #                        192.168.2.0/24 using eth2.
  208. #
  209. #                        Your entries for this setup would look like:
  210. #
  211. #                        net        eth0        206.191.149.223        dhcp
  212. #                        local        eth1        192.168.1.255
  213. #                        dmz        eth2        192.168.2.255
  214. #
  215. #        Example 2:        The same configuration without specifying broadcast
  216. #                        addresses is:
  217. #
  218. #                        net        eth0        detect                dhcp
  219. #                        loc        eth1        detect
  220. #                        dmz        eth2        detect
  221. #
  222. #        Example 3:        You have a simple dial-in system with no ethernet
  223. #                        connections.
  224. #
  225. #                        net        ppp0        -
  226. #
  227. # For additional information, see
  228. # http://shorewall.net/Documentation.htm#Interfaces
  229. #
  230. ###############################################################################
  231. #ZONE        INTERFACE        BROADCAST        OPTIONS
  232. net        eth1
  233. #LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE
复制代码

Policy配置

  1. #
  2. # Shorewall version 3.2 - Policy File
  3. #
  4. # /etc/shorewall/policy
  5. #
  6. #                     THE ORDER OF ENTRIES IN THIS FILE IS IMPORTANT
  7. #
  8. #        This file determines what to do with a new connection request if we
  9. #        don't get a match from the /etc/shorewall/rules file . For each
  10. #        source/destination pair, the file is processed in order until a
  11. #        match is found ("all" will match any client or server).
  12. #
  13. #                        INTRA-ZONE POLICIES ARE PRE-DEFINED
  14. #
  15. #        For $FW and for all of the zoned defined in /etc/shorewall/zones,
  16. #        the POLICY for connections from the zone to itself is ACCEPT (with no
  17. #        logging or TCP connection rate limiting but may be overridden by an
  18. #        entry in this file. The overriding entry must be explicit (cannot use
  19. #        "all" in the SOURCE or DEST).
  20. #
  21. #       Similarly, if you have IMPLICIT_CONTINUE=Yes in shorewall.conf, then
  22. #       the implicit policy to/from any sub-zone is CONTINUE. These implicit
  23. #       CONTINUE policies may also be overridden by an explicit entry in this
  24. #       file.
  25. #
  26. # Columns are:
  27. #
  28. #        SOURCE                Source zone. Must be the name of a zone defined
  29. #                        in /etc/shorewall/zones, $FW or "all".
  30. #
  31. #        DEST                Destination zone. Must be the name of a zone defined
  32. #                        in /etc/shorewall/zones, $FW or "all"
  33. #
  34. #        POLICY                Policy if no match from the rules file is found. Must
  35. #                        be "ACCEPT", "DROP", "REJECT", "CONTINUE" or "NONE".
  36. #
  37. #                        ACCEPT                - Accept the connection
  38. #                        DROP                - Ignore the connection request
  39. #                        REJECT                - For TCP, send RST. For all other,
  40. #                                          send "port unreachable" ICMP.
  41. #                        QUEUE                - Send the request to a user-space
  42. #                                          application using the QUEUE target.
  43. #                        CONTINUE        - Pass the connection request past
  44. #                                          any other rules that it might also
  45. #                                          match (where the source or
  46. #                                          destination zone in those rules is
  47. #                                          a superset of the SOURCE or DEST
  48. #                                          in this policy).
  49. #                        NONE                - Assume that there will never be any
  50. #                                          packets from this SOURCE
  51. #                                          to this DEST. Shorewall will not set
  52. #                                          up any infrastructure to handle such
  53. #                                          packets and you may not have any
  54. #                                          rules with this SOURCE and DEST in
  55. #                                          the /etc/shorewall/rules file. If
  56. #                                          such a packet _is_ received, the
  57. #                                          result is undefined. NONE may not be
  58. #                                          used if the SOURCE or DEST columns
  59. #                                          contain the firewall zone ($FW) or
  60. #                                          "all".
  61. #
  62. #                        If this column contains ACCEPT, DROP or REJECT and a
  63. #                        corresponding common action is defined in
  64. #                        /etc/shorewall/actions (or
  65. #                        /usr/share/shorewall/actions.std) then that action
  66. #                        will be invoked before the policy named in this column
  67. #                        is enforced.
  68. #
  69. #        LOG LEVEL        If supplied, each connection handled under the default
  70. #                        POLICY is logged at that level. If not supplied, no
  71. #                        log message is generated. See syslog.conf(5) for a
  72. #                        description of log levels.
  73. #
  74. #                        Beginning with Shorewall version 1.3.12, you may
  75. #                        also specify ULOG (must be in upper case). This will
  76. #                        log to the ULOG target and sent to a separate log
  77. #                        through use of ulogd
  78. #                        (http://www.gnumonks.org/projects/ulogd).
  79. #
  80. #                        If you don't want to log but need to specify the
  81. #                        following column, place "-" here.
  82. #
  83. #        LIMIT:BURST        If passed, specifies the maximum TCP connection rate
  84. #                        and the size of an acceptable burst. If not specified,
  85. #                        TCP connections are not limited.
  86. #
  87. #        Example:
  88. #
  89. #        a) All connections from the local network to the internet are allowed
  90. #        b) All connections from the internet are ignored but logged at syslog
  91. #           level KERNEL.INFO.
  92. #        d) All other connection requests are rejected and logged at level
  93. #           KERNEL.INFO.
  94. #
  95. #        #SOURCE                DEST                POLICY                LOG
  96. #        #                                                LEVEL
  97. #        loc                net                ACCEPT
  98. #        net                all                DROP                info
  99. #        #
  100. #        # THE FOLLOWING POLICY MUST BE LAST
  101. #        #
  102. #        all                all                REJECT                info
  103. #
  104. # See http://shorewall.net/Documentation.htm#Policy for additional information.
  105. #
  106. ###############################################################################
  107. #SOURCE                DEST                POLICY                LOG                LIMIT:BURST
  108. #                                                LEVEL
  109. fw        all        ACCEPT
  110. net        all        DROP
  111. all        all        REJECT
  112. #LAST LINE -- DO NOT REMOVE
复制代码

人后rules和masq都是空的

就这样,还是把我给挡住出不去,真乃神奇,我现在只想到两种可能,1,ppp拨号方式和shorewall有兼容问题,2.pppoe拨号方式的nat设置有特别的地方,只有这两种可能了,请高手指教,谢谢,小弟实在是想不出还有什么不对的地方了
发表于 2007-8-9 21:38:33 | 显示全部楼层
还不如,直接自己写iptables 呢。

简单实在,太复杂的东西,不喜欢玩。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-8-9 21:48:51 | 显示全部楼层
Post by GaryWuGang
还不如,直接自己写iptables 呢。

简单实在,太复杂的东西,不喜欢玩。


iptables简单?天啊,光看手册我都要疯了,就是因为怕了iptables才跑来用shorewall的
回复 支持 反对

使用道具 举报

发表于 2007-8-9 22:26:36 | 显示全部楼层
记得之前有这样说过。
原来你是pppoe呀,防火墙设定时“要举一反三”了。

在Masq的配置文件中,不难发现问题
#INTERFACE                SUBNET                ADDRESS                PROTO        PORT(S)        IPSEC
eth1     eth0
#LAST LINE -- ADD YOUR ENTRIES ABOVE THIS LINE -- DO NOT REMOVE


用ppp0 来替换你的外网 eth1,或者增加ppp0相关设定。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-8-9 22:55:35 | 显示全部楼层
Post by linuxth
记得之前有这样说过。

在Masq的配置文件中,不难发现问题


用ppp0 来替换你的外网 eth1,或者增加ppp0相关设定。

你的意思是说,ppp0才是我的上网界面,eth1不是,那么我在Interfaces就必须写成

net      ppp0

这样写吗?然后把masq里给写成
ppp0   eth0
这么干?
经你这么一说我想起来了,我今天回来看某shorewall帖子的时候看到这么一句:


  1. interfaces文件:

  2. [Copy to clipboard] [ - ]CODE:
  3. #ZONE   INTERFACE       BROADCAST       OPTIONS
  4. loc     eth1            -
  5. net     eth0            -
  6. dmz     eth2            -
  7. 这里是定义网络界面的文件,也就是将zone文件里面建立的区域和实际网络界面联系起来。
  8. 每行都是指实际的网络界面。除了普通的eth外,你还可以使用ppp界面例如:
  9. [color=red]loc   ppp+    -这里的意思是本地网络是用户拨号到防火墙的。[/color]
复制代码


看来我还是windows的习惯思维,只看到了网卡界面,没有想到pppoe的连接界面是不同的……

PS:请问你有什么建议解决我说的那个shorewall stop的时候会自动堵塞所有外部对fw的访问的问题,我查了shorewall.conf文件里的文档,就没找到哪一个项能关掉这功能
回复 支持 反对

使用道具 举报

发表于 2007-8-9 23:09:31 | 显示全部楼层
是的,你的理解正确,增加ppp界面再来测试防火墙。

注:启动防火墙时,ppp要处于连接状态。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-8-9 23:20:52 | 显示全部楼层
Post by linuxth
是的,你的理解正确,增加ppp界面再来测试防火墙。

注:启动防火墙时,ppp要处于连接状态。


等以下,ppp要处于连接状态?不能先启动防火墙后拨号吗?这可就是麻烦问题了,那这样NAT就无法无人值守了,比如停电后来电,我怎么让shorewall在拨号上去了再启动呢……晕
回复 支持 反对

使用道具 举报

发表于 2007-8-9 23:23:49 | 显示全部楼层
设为开机自动拔号。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-8-9 23:31:48 | 显示全部楼层
Post by linuxth
设为开机自动拔号。

那不是问题,如何保证开机拨号拨上去了以后shorewall才启动才是难题……

对了,还有更麻烦的,万一掉线了,shorewall会怎么样,这才更头疼……
PS:那个shorewall stop后会堵塞所有外部对fw区域的访问的问题,你有没有发现,有解决方法吗?
回复 支持 反对

使用道具 举报

发表于 2007-8-9 23:49:18 | 显示全部楼层
如何保证开机拨号拨上去了以后shorewall才启动才是难题……

嗯,可以如愿的。
万一掉线了,shorewall会怎么样,这才更头疼

嗯,试图让ppp断线重拔,ShareWall应该可以继续工作的(这个需要测试一下)

ps的问题不清楚,没碰到,等你防火墙能正常工作后,再回头看这个问题,是否存在。
回复 支持 反对

使用道具 举报

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

本版积分规则

快速回复 返回顶部 返回列表