SlideShare a Scribd company logo
1 of 9
SRX Automation 3:
Configuring NAT
Automate NAT config
 Develop a srx NAT config file
 Separate the Variables and Command
 Create a YAML file to store the variable (Playbook)
 Create a Jinja2 template to execute the command
line (template)
 Use “junos_install_config” from the Ansible module to
update SRX configuration.
Example:
Create SRX address
book
 CLI for create address book:
 #set security address-book global address LocalNet 172.16.0.0/24
 #set security address-book global address PrivateNet
192.168.10.0/24
 #set security address-book global address PublicNet 10.10.0.0/22
 Hence, we have separate the CLI into
 Variables:
 name: LocalNet, prefix: 172.16.0.0/24
 name: PrivateNet, prefix: 192.168.10.0/24
 name: PublicNet, prefix: 10.10.0.0/22
 Actions:
 Set security address-book global address {name} {prefix}
Example:
Create SRX address
book
 Variable are defined in the playbook (basic_nat_policies.yml)
vars: junos_user: "root"
junos_password: "Juniper"
build_dir: "/tmp/"
address_entries: [
{'name':'LocalNet','prefix':'172.16.0.0/24'},
{'name':'PrivateNet','prefix':'192.168.10.0/24'},
{'name':'PublicNet','prefix':'10.10.0.0/22'} ]
Example:
Create SRX address
book
 To update SRX, 2 tasks are defined in playbook
 1, build a configuration file in /tmp directory
 2, update srx config with junos_update_config
Example 2:
Create Src Nat Config
 Sample Source Nat Configuration
Example 2:
Create Src Nat Config
 Define variable nat_policy_info:
 nat_policy_info: [{'rule_set':'fw-nat’, 'src_zone':'trust',
'dst_zone':'untrust',
'rules':[{'name':'rule1','src_ips':['172.16.0.0/24'],'dst_ips':[
'0.0.0.0/0'], 'interface':True}]}]
Example 2:
Create Src Nat Config
 Define jinja2 template (nat_src_policy.set.j2):
Example 2:
Create Src Nat Config
 Define 2 tasks (basic_nat_policies.yml)
 Build a temporary config file in /tmp
 Update the SRX config file.

More Related Content

What's hot

Get mysql clusterrunning-windows
Get mysql clusterrunning-windowsGet mysql clusterrunning-windows
Get mysql clusterrunning-windows
JoeSg
 
Wlst deployment library
Wlst deployment libraryWlst deployment library
Wlst deployment library
naveenmartha
 

What's hot (20)

Juju 基礎編
Juju 基礎編Juju 基礎編
Juju 基礎編
 
Solaris mysql sop
Solaris mysql sopSolaris mysql sop
Solaris mysql sop
 
Database systems administration traning 0
Database systems administration traning 0Database systems administration traning 0
Database systems administration traning 0
 
الفصل السابع - التخزين الثانوي- د. خالد بكرو Secondary Storage - Dr. Khaled B...
الفصل السابع - التخزين الثانوي- د. خالد بكرو Secondary Storage - Dr. Khaled B...الفصل السابع - التخزين الثانوي- د. خالد بكرو Secondary Storage - Dr. Khaled B...
الفصل السابع - التخزين الثانوي- د. خالد بكرو Secondary Storage - Dr. Khaled B...
 
How to persist data with Redis
How to persist data with RedisHow to persist data with Redis
How to persist data with Redis
 
How to install Odoo 13 in Ubuntu ?
How to install Odoo 13 in Ubuntu ?How to install Odoo 13 in Ubuntu ?
How to install Odoo 13 in Ubuntu ?
 
Ac cuda c_3
Ac cuda c_3Ac cuda c_3
Ac cuda c_3
 
Redmine on amazon ec2
Redmine on amazon ec2Redmine on amazon ec2
Redmine on amazon ec2
 
Juju + KubernetesでGPU の活用
Juju + KubernetesでGPU の活用Juju + KubernetesでGPU の活用
Juju + KubernetesでGPU の活用
 
Java concurrency introduction
Java concurrency introductionJava concurrency introduction
Java concurrency introduction
 
Ac cuda c_2
Ac cuda c_2Ac cuda c_2
Ac cuda c_2
 
Cookies in php
Cookies in phpCookies in php
Cookies in php
 
2
22
2
 
{'python': 'dict'}
{'python': 'dict'}{'python': 'dict'}
{'python': 'dict'}
 
Configuration of jms jndi
Configuration of jms jndiConfiguration of jms jndi
Configuration of jms jndi
 
Get mysql clusterrunning-windows
Get mysql clusterrunning-windowsGet mysql clusterrunning-windows
Get mysql clusterrunning-windows
 
Copycons
CopyconsCopycons
Copycons
 
gpenting Indexfile
gpenting Indexfilegpenting Indexfile
gpenting Indexfile
 
Wlst deployment library
Wlst deployment libraryWlst deployment library
Wlst deployment library
 
ข่าวIt
ข่าวItข่าวIt
ข่าวIt
 

Similar to vSRX automation 3: NAT

Similar to vSRX automation 3: NAT (20)

Book
BookBook
Book
 
Namespaces and cgroups - the basis of Linux containers
Namespaces and cgroups - the basis of Linux containersNamespaces and cgroups - the basis of Linux containers
Namespaces and cgroups - the basis of Linux containers
 
DevOps Enabling Your Team
DevOps Enabling Your TeamDevOps Enabling Your Team
DevOps Enabling Your Team
 
R server and spark
R server and sparkR server and spark
R server and spark
 
Protecting host with calico
Protecting host with calicoProtecting host with calico
Protecting host with calico
 
Setting up mongodb sharded cluster in 30 minutes
Setting up mongodb sharded cluster in 30 minutesSetting up mongodb sharded cluster in 30 minutes
Setting up mongodb sharded cluster in 30 minutes
 
Building a Linux IPv6 DNS Server Project review PPT v3.0 First review
Building a Linux IPv6 DNS Server Project review PPT v3.0 First reviewBuilding a Linux IPv6 DNS Server Project review PPT v3.0 First review
Building a Linux IPv6 DNS Server Project review PPT v3.0 First review
 
Custom faultpolicies
Custom faultpoliciesCustom faultpolicies
Custom faultpolicies
 
Custom faultpolicies
Custom faultpoliciesCustom faultpolicies
Custom faultpolicies
 
Custom faultpolicies
Custom faultpoliciesCustom faultpolicies
Custom faultpolicies
 
Hands-on Lab: Comparing Redis with Relational
Hands-on Lab: Comparing Redis with RelationalHands-on Lab: Comparing Redis with Relational
Hands-on Lab: Comparing Redis with Relational
 
Gr8conf EU 2018 - Bring you infrastructure under control with Infrastructor
Gr8conf EU 2018 - Bring you infrastructure under control with InfrastructorGr8conf EU 2018 - Bring you infrastructure under control with Infrastructor
Gr8conf EU 2018 - Bring you infrastructure under control with Infrastructor
 
OR Mapping- nhibernate Presentation
OR Mapping- nhibernate PresentationOR Mapping- nhibernate Presentation
OR Mapping- nhibernate Presentation
 
C# and Borland StarTeam Connectivity
C# and Borland StarTeam ConnectivityC# and Borland StarTeam Connectivity
C# and Borland StarTeam Connectivity
 
OpenSSL Basic Function Call Flow
OpenSSL Basic Function Call FlowOpenSSL Basic Function Call Flow
OpenSSL Basic Function Call Flow
 
Hibernate
Hibernate Hibernate
Hibernate
 
Freeradius edir
Freeradius edirFreeradius edir
Freeradius edir
 
Lksn2017 itnsa modul2
Lksn2017 itnsa modul2Lksn2017 itnsa modul2
Lksn2017 itnsa modul2
 
Cloud Meetup - Automation in the Cloud
Cloud Meetup - Automation in the CloudCloud Meetup - Automation in the Cloud
Cloud Meetup - Automation in the Cloud
 
Play 2.0
Play 2.0Play 2.0
Play 2.0
 

Recently uploaded

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 

Recently uploaded (20)

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 

vSRX automation 3: NAT

  • 2. Automate NAT config  Develop a srx NAT config file  Separate the Variables and Command  Create a YAML file to store the variable (Playbook)  Create a Jinja2 template to execute the command line (template)  Use “junos_install_config” from the Ansible module to update SRX configuration.
  • 3. Example: Create SRX address book  CLI for create address book:  #set security address-book global address LocalNet 172.16.0.0/24  #set security address-book global address PrivateNet 192.168.10.0/24  #set security address-book global address PublicNet 10.10.0.0/22  Hence, we have separate the CLI into  Variables:  name: LocalNet, prefix: 172.16.0.0/24  name: PrivateNet, prefix: 192.168.10.0/24  name: PublicNet, prefix: 10.10.0.0/22  Actions:  Set security address-book global address {name} {prefix}
  • 4. Example: Create SRX address book  Variable are defined in the playbook (basic_nat_policies.yml) vars: junos_user: "root" junos_password: "Juniper" build_dir: "/tmp/" address_entries: [ {'name':'LocalNet','prefix':'172.16.0.0/24'}, {'name':'PrivateNet','prefix':'192.168.10.0/24'}, {'name':'PublicNet','prefix':'10.10.0.0/22'} ]
  • 5. Example: Create SRX address book  To update SRX, 2 tasks are defined in playbook  1, build a configuration file in /tmp directory  2, update srx config with junos_update_config
  • 6. Example 2: Create Src Nat Config  Sample Source Nat Configuration
  • 7. Example 2: Create Src Nat Config  Define variable nat_policy_info:  nat_policy_info: [{'rule_set':'fw-nat’, 'src_zone':'trust', 'dst_zone':'untrust', 'rules':[{'name':'rule1','src_ips':['172.16.0.0/24'],'dst_ips':[ '0.0.0.0/0'], 'interface':True}]}]
  • 8. Example 2: Create Src Nat Config  Define jinja2 template (nat_src_policy.set.j2):
  • 9. Example 2: Create Src Nat Config  Define 2 tasks (basic_nat_policies.yml)  Build a temporary config file in /tmp  Update the SRX config file.