LinuxSecurity.com
Share your story
The central voice for Linux and Open Source security news
Home News Topics Advisories HOWTOs Features Newsletters About Register

Welcome!
Sign up!
EnGarde Community
Login
Polls
What is the most important Linux security technology?
 
Advisories
Community
Linux Events
Linux User Groups
Link to Us
Security Center
Book Reviews
Security Dictionary
Security Tips
SELinux
White Papers
Featured Blogs
All About Linux
DanWalsh LiveJournal
Securitydistro
Latest Newsletters
Linux Security Week: July 28th, 2014
Linux Advisory Watch: July 25th, 2014
Subscribe
LinuxSecurity Newsletters
E-mail:
Choose Lists:
About our Newsletters
RSS Feeds
Get the LinuxSecurity news you want faster with RSS
Powered By

  
( MASQ and Dynamic IPs ) - Does IP Masquerade work with dynamically assigned IP addresses?

7.8. ( MASQ and Dynamic IPs ) - Does IP Masquerade work with dynamically assigned IP addresses?

Yes, it works with either dynamic IP addressed assigned by your ISP via either PPP or a DHCP server (common for Cablemodem and DSL users). As long as you have a valid Internet IP address, it should work. Of course, static IPs work too. If you plan on implementing a strong IPTABLES, IPCHAINS, or IPFWADM ruleset and/or plan on using a Port forwarder, your ruleset will have to be re-executed everytime your IP address changes.

So, re-running the rc-firewall-* ruleset really depends on which method you get your IP addresses:

  • PPP: The /etc/ppp/ip-up script is always run when a PPP connection comes up. Because of this, we can make the rc.firewall-* go get the new PPP IP address and update the firewall ruleset. If the /etc/ppp/ip-up file doesn't exist or if does exists, simply edit that file and append a line containing the name of your chosen firewall ruleset. For example, to run the SIMPLE IPTABLES ruleset:

    /etc/rc.d/rc.firewall-iptables
       

  • DHCP: If you get your IP address via DHCP, common for Cablemodem and DSL users, it's easy get the rc.firewall-* ruleset to run when you get a new IP lease. How this happens depends on what DHCP client your distribution uses:

    • dhclient : Most modern Linux distributions use dhclient from ISC. To re-run your specific rc-firewall-* script when your system gets a new IP address, add the following line to the /etc/dhclient-exit-hooks file. Please note that this example is loging the SIMPLE IPTABLES ruleset. Please use the correct rc.firewall-* name for your specific setup:

      /etc/rc.d/rc.firewall-iptables
          

    • pump : Many older Redhat distributions use this DHCP client. To re-run the rc-firewall-* script when your system gets a new IP address, add the following line to the /etc/pump.conf file. Please note that this example is loading the SIMPLE IPTABLES ruleset. Please use the correct rc.firewall-* name for your specific setup:

      script /etc/rc.d/rc.firewall-iptables
          

    • dhcpcd : Many older distros use this DHCP client. To re-run the rc-firewall-* script when your system gets a new IP address depends on which verion of dhcpcd you're using.

      For newer dhcpcd client versions, append the following line to the /etc/dhcpcd-[interface].exe file. Please note that you have to replace the [interface] text with the name of your Interface connecting to the Internet. For this example, we are going run the SIMPLE IPTABLES ruleset against the eth0 interface by editing the /etc/dhcpc/dhcpcd-eth0.exe file:

      /etc/rc.d/rc.firewall-iptables
           

      For old dhcpcd client versions, you need to figure out what script starts up dhcpcd (depends on the Linux distribution and it's version). From there, you need to replace the specific dhcpcd line with the folling line with the correct Internet-facing interface name. For this example, dhcpcd will run the SIMPLE IPTABLES ruleset against the eth0 interface:

      dhcpcd -c /etc/rc.d/rc.firewall eth0
          

Please also see the top of TrinityOS - Section 10 for additional help with strong firewall rulesets and Dynamic IP addresses.

    
Partner

 

Latest Features
Peter Smith Releases Linux Network Security Online
Securing a Linux Web Server
Password guessing with Medusa 2.0
Password guessing as an attack vector
Squid and Digest Authentication
Squid and Basic Authentication
Demystifying the Chinese Hacking Industry: Earning 6 Million a Night
Free Online security course (LearnSIA) - A Call for Help
What You Need to Know About Linux Rootkits
Review: A Practical Guide to Fedora and Red Hat Enterprise Linux - Fifth Edition
Yesterday's Edition
Ottawa Linux Symposium: May get by with a little help from its friends
Black Hat 2014: How to crack just about everything
NSA Playset, 911 hacked and war cats: A wild ride at DEF CON 22
More Details of Onion/Critroni Crypto Ransomware Emerge
Is there Another NSA Leaker? Updated
Partner Sponsor

Community | HOWTOs | Blogs | Features | Book Reviews | Networking
 Security Projects |  Latest News |  Newsletters |  SELinux |  Privacy |  Home
 Hardening |   About Us |   Advertise |   Legal Notice |   RSS |   Guardian Digital
(c)Copyright 2014 Guardian Digital, Inc. All rights reserved.