Juniper SRX345配置NAT46与NAT64
NAT46
测试拓扑
Model: srx345
Junos: 15.1X49-D140.2
JUNOS Software Release [15.1X49-D140.2]
配置步骤
- Configure SRX to handle Ipv6 traffic
lab# set security forwarding-options family inet6 mode flow-based
lab# show security
forwarding-options {
family {
inet6 {
mode flow-based;
}
}
}
warning: You have enabled/disabled inet6 flow.
You must reboot the system for your change to take effect.
If you have deployed a cluster, be sure to reboot all nodes.
当启用Ipv6后,要求必须重启设备后才生效!
- Configure both source and destination nat
[edit security nat]
lab# show destination
pool ipv6-dest-pool {
address 2001:db8::8/128;
}
rule-set ipv4-dest {
from zone trust;
rule ipv4-host-dest {
match {
source-address 192.168.1.200/32;
destination-address 192.168.2.8/32;
}
then {
destination-nat {
pool {
ipv6-dest-pool;
}
}
}
}
}
[edit security nat]
lab# show source
pool ipv6-source-pool {
address {
2001:db8::200/128;
}
}
rule-set ipv4-source {
from zone trust;
to zone untrust;
rule ipv4-host-source {
match {
source-address 192.168.1.200/32;
destination-address 2001:db8::8/128;
}
then {
source-nat {
pool {
ipv6-source-pool;
}
}
}
}
}
- Configure Proxy-ndp
[edit security nat]
root# show proxy-ndp
interface ge-0/0/7.0 {
address {
2001:db8::200/128;
}
}
- Configure policy
root# show security policies
from-zone trust to-zone untrust {
policy 1 {
match {
source-address 192.168.1.200/32;
destination-address 2001:db8::8/128;
application any;
}
then {
permit;
}
}
}
- Show security flow session
root> show security flow session
Session ID: 8263, Policy name: 1/4, Timeout: 2, Valid
In: 192.168.1.200/2330 --> 192.168.2.8/1;icmp, Conn Tag: 0x0, If: ge-0/0/0.0, Pkts: 1, Bytes: 60,
Out: 2001:db8::8/1 --> 2001:db8::200/2387;icmp6, Conn Tag: 0x0, If: ge-0/0/7.0, Pkts: 1, Bytes: 80,
Session ID: 8266, Policy name: 1/4, Timeout: 2, Valid
In: 192.168.1.200/2331 --> 192.168.2.8/1;icmp, Conn Tag: 0x0, If: ge-0/0/0.0, Pkts: 1, Bytes: 60,
Out: 2001:db8::8/1 --> 2001:db8::200/8271;icmp6, Conn Tag: 0x0, If: ge-0/0/7.0, Pkts: 1, Bytes: 80,
Session ID: 8269, Policy name: 1/4, Timeout: 4, Valid
In: 192.168.1.200/2332 --> 192.168.2.8/1;icmp, Conn Tag: 0x0, If: ge-0/0/0.0, Pkts: 1, Bytes: 60,
Out: 2001:db8::8/1 --> 2001:db8::200/14318;icmp6, Conn Tag: 0x0, If: ge-0/0/7.0, Pkts: 1, Bytes: 80,
Total sessions: 3
NAT64
测试拓扑
Model: srx345
Junos: 15.1X49-D140.2
JUNOS Software Release [15.1X49-D140.2]
配置步骤
- Configure SRX to handle Ipv6 traffic
lab# set security forwarding-options family inet6 mode flow-based
lab# show security
forwarding-options {
family {
inet6 {
mode flow-based;
}
}
}
warning: You have enabled/disabled inet6 flow.
You must reboot the system for your change to take effect.
If you have deployed a cluster, be sure to reboot all nodes.
当启用Ipv6后,要求必须重启设备后才生效!
-Configure both source and destination nat
[edit security nat]
root@test# show destination
pool ipv4-dest-pool {
address 192.168.1.200/32;
}
rule-set ipv6-dest {
from zone untrust;
rule ipv6-host-dest {
match {
source-address 2001:db8::8/128;
destination-address 2001:db8::200/32;
}
then {
destination-nat {
pool {
ipv4-dest-pool;
}
}
}
}
}
[edit security nat]
lab# show source
pool ipv6-source-pool {
address {
2001:db8::200/128;
}
}
[edit security nat]
root@test# show source
pool ipv4-source-pool {
address {
192.168.1.111/32;
}
}
rule-set ipv6-source {
from zone untrust;
to zone trust;
rule ipv6-host-source {
match {
source-address 2001:db8::8/32;
destination-address 192.168.1.200/32;
}
then {
source-nat {
pool {
ipv4-source-pool;
}
}
}
}
}
-Configure Proxy-ndp and Proxy-arp
[edit security nat]
root@test# show proxy-ndp
interface ge-0/0/7.0 {
address {
2001:db8::200/128;
}
}
[edit security nat]
root@test# show proxy-arp
interface ge-0/0/0.0 {
address {
192.168.1.111/32;
}
}
- Configure policy
root@test# show security policies
from-zone untrust to-zone trust {
policy 2 {
match {
source-address 2001:db8::8/128;
destination-address 192.168.1.200/32;
application any;
}
then {
permit;
}
}
}
- Show security flow session
root@test# run show security flow session
Session ID: 57895, Policy name: 2/5, Timeout: 2, Valid
In: 2001:db8::8/1459 --> 2001:db8::200/1;icmp6, Conn Tag: 0x0, If: ge-0/0/7.0, Pkts: 1, Bytes: 80,
Out: 192.168.1.200/1 --> 192.168.1.111/30023;icmp, Conn Tag: 0x0, If: ge-0/0/0.0, Pkts: 1, Bytes: 60,
Session ID: 57896, Policy name: 2/5, Timeout: 2, Valid
In: 2001:db8::8/1460 --> 2001:db8::200/1;icmp6, Conn Tag: 0x0, If: ge-0/0/7.0, Pkts: 1, Bytes: 80,
Out: 192.168.1.200/1 --> 192.168.1.111/9601;icmp, Conn Tag: 0x0, If: ge-0/0/0.0, Pkts: 1, Bytes: 60,
Session ID: 57898, Policy name: 2/5, Timeout: 4, Valid
In: 2001:db8::8/1461 --> 2001:db8::200/1;icmp6, Conn Tag: 0x0, If: ge-0/0/7.0, Pkts: 1, Bytes: 80,
Out: 192.168.1.200/1 --> 192.168.1.111/2871;icmp, Conn Tag: 0x0, If: ge-0/0/0.0, Pkts: 1, Bytes: 60,
Session ID: 57899, Policy name: 2/5, Timeout: 4, Valid
In: 2001:db8::8/1462 --> 2001:db8::200/1;icmp6, Conn Tag: 0x0, If: ge-0/0/7.0, Pkts: 1, Bytes: 80,
Out: 192.168.1.200/1 --> 192.168.1.111/26395;icmp, Conn Tag: 0x0, If: ge-0/0/0.0, Pkts: 1, Bytes: 60,
Total sessions: 4