|
发表于 2004-11-10 22:32:44
|
显示全部楼层
NotesThe source nat can masquerade several private networks, and use individual to-src-address foreach of them.Masquerading chooses outgoing packets' source addresses according to the preferred-addressproperty of the relevant route.ExampleTo use masquerading, a source NAT rule with action=masquerade should be added to the src-natrule set:[admin@test_1] ip firewall src-nat> add src-address=192.168.0.0/24 \\... out-interface=wlan1 action=masquerade[admin@test_1] ip firewall src-nat> printFlags: X - disabled, I - invalid, D - dynamic0 src-address=192.168.0.0/24:0-65535 dst-address=0.0.0.0/0:0-65535out-interface=wlan1 protocol=all icmp-options=any:any flow=""connection="" content="" limit-count=0 limit-burst=0 limit-time=0saction=masquerade to-src-address=0.0.0.0 to-src-port=0-65535[admin@test_1] ip firewall src-nat>If the packet matches the masquerade rule, then the router opens a connection to the destination,and sends out a modified packet with its own address and a port allocated for this connection. Therouter keeps track about masqueraded connections and performs the "demasquerading" of packets,which arrive for the opened connections. For filtering purposes, you may want to specify theto-src-ports argument value, say, to 60000-65535If you want to change the source address:port to specific adress:port, use the action=nat instead ofaction=masquerade:[admin@test_1] ip firewall src-nat> add src-address=192.168.0.1/32 out-interface=wlan1 action=nat to-src-address=1.1.1.1[admin@test_1] ip firewall src-nat> printFlags: X - disabled, I - invalid, D - dynamic0 src-address=192.168.0.1/32:0-65535 dst-address=0.0.0.0/0:0-65535out-interface=wlan1 protocol=all icmp-options=any:any flow=""connection="" content="" limit-count=0 limit-burst=0 limit-time=0saction=nat to-src-address=1.1.1.1 to-src-port=0-65535[admin@test_1] ip firewall src-nat>Here, the: src-address - can be IP host's address, for example, 192.168.0.1/32, or network address192.168.0.0/24 to-src-address - can be one address, or a range, say 10.0.0.217-10.0.0.219. The addressesshould be added to the router's interface, or should be routed to it from the gateway router. |
|