-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAdd NAT Rules Command Line.sh
67 lines (62 loc) · 2.15 KB
/
Add NAT Rules Command Line.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Login to the Edgerouter
# Enter configure Mode
## Edit the following according to your needs:
Firewall Policy Group:
## WAN_IN
Firewall Name:
## WAN_IN
Change Rule Description
rule 99 description 'Rule description'
Change Address
## rule 99 destination address 192.168.1.160
Change port
## rule 99 destination port 80
Enable or Disable Logging
Enable:
## set firewall name WAN_IN rule 99 log enable
Disable:
## set firewall name WAN_IN rule 99 log disable
Change the protocol if needed
## rule 99 protocol tcp - tcp_udp
Change the NAT rule Description:
## rule 21 description 'Rule description port 80'
Change the External IP if you have multiple External IPS of not remove the rule
## set service nat rule 21 destination address 185.40.40.1
Change port:
## rule 21 destination port 80
Change inbound-interface if needed:
## rule 21 inbound-interface eth0
Change inbound-address:
## rule 21 inside-address address 192.168.1.160
Change inside-address port:
## rule 21 inside-address port 80
Enable or Disable Logging
Enable:
## set service nat rule 21 log enable
Disable:
## set service nat rule 21 log disable
Change protocol:
## rule 21 protocol tcp - tcp_udp
Change the commit comment:
## commit comment "Comment what you have changed"
############ Code to execute on Router ############
'''
configure
set firewall group address-group WAN_IN address 192.168.1.160
set firewall name WAN_IN rule 99 action accept
set firewall name WAN_IN rule 99 description 'Rule description'
set firewall name WAN_IN rule 99 destination address 192.168.1.160
set firewall name WAN_IN rule 99 destination port 80
set firewall name WAN_IN rule 99 log enable
set firewall name WAN_IN rule 99 protocol tcp
set service nat rule 21 description 'Rule description port 80'
set service nat rule 21 destination address 185.40.40.1
set service nat rule 21 destination port 80
set service nat rule 21 inbound-interface eth0
set service nat rule 21 inside-address address 192.168.1.160
set service nat rule 21 inside-address port 80
set service nat rule 21 log enable
set service nat rule 21 protocol tcp
set service nat rule 21 type destination
commit comment “Comment what you have changed”
save'''