Post History
I'm playing with NAT, and have a script now that, at startup of my little Linux machine, creates some DNAT rules, which take one incoming special port, and forward that to another interface with a ...
Question
networking
#3: Post edited
I'm playing with NAT, and have a script now that, at startup of my little Linux machine, creates some DNAT rules, which take one incoming special port, and forward that to another interface with a standard e.g. SSH port, so I can talk to this Linux box, from the outside, and it its copnnected 2nd box, as if it were one machine, but different ports.- The interface to the outside world was, so far, configured with static IP.
- But it *might* need configuring for dynamic assignment.
- So, my simple startup bash script adding the DNAt rules with iptables, then won't work anymore:
- 1. it can only be called when it's clear that the interface has gotten an IP
- 2. the interface could lose the IP (lease) at some point - then the old DNAt rules need to be deleted (?) and new ones added for the updated IP address of the interface in question.
- Is there some sort of callback mechanism in Linux that I can hook into, so it tells me when the IP address was changed/assigned, and I can then react to that by fixing the DNAT rules?
- I'm playing with NAT, and have a script now that, at startup of my little Linux machine, creates some DNAT rules, which take one incoming special port, and forward that to another interface with a standard e.g. SSH port, so I can talk to this Linux box, from the outside, and to its connected 2nd box, as if it were one machine, but different ports.
- The interface to the outside world was, so far, configured with static IP.
- But it *might* need configuring for dynamic assignment.
- So, my simple startup bash script adding the DNAt rules with iptables, then won't work anymore:
- 1. it can only be called when it's clear that the interface has gotten an IP
- 2. the interface could lose the IP (lease) at some point - then the old DNAt rules need to be deleted (?) and new ones added for the updated IP address of the interface in question.
- Is there some sort of callback mechanism in Linux that I can hook into, so it tells me when the IP address was changed/assigned, and I can then react to that by fixing the DNAT rules?
#2: Post edited
I'm playing with NAT, and have a script now that, among others, at startup of my little Linux machine, creates some DNAT rules, which take one incoming special port, and forward that to enother interface with a standard e.g. SSH port, so I can talk to this Linux box, from the outside, and it its copnnected 2nd box, as if it were one machine, but different ports.- The interface to the outside world was, so far, configured with static IP.
- But it *might* need configuring for dynamic assignment.
- So, my simple startup bash script adding the DNAt rules with iptables, then won't work anymore:
- 1. it can only be called when it's clear that the interface has gotten an IP
- 2. the interface could lose the IP (lease) at some point - then the old DNAt rules need to be deleted (?) and new ones added for the updated IP address of the interface in question.
- Is there some sort of callback mechanism in Linux that I can hook into, so it tells me when the IP address was changed/assigned, and I can then react to that by fixing the DNAT rules?
- I'm playing with NAT, and have a script now that, at startup of my little Linux machine, creates some DNAT rules, which take one incoming special port, and forward that to another interface with a standard e.g. SSH port, so I can talk to this Linux box, from the outside, and it its copnnected 2nd box, as if it were one machine, but different ports.
- The interface to the outside world was, so far, configured with static IP.
- But it *might* need configuring for dynamic assignment.
- So, my simple startup bash script adding the DNAt rules with iptables, then won't work anymore:
- 1. it can only be called when it's clear that the interface has gotten an IP
- 2. the interface could lose the IP (lease) at some point - then the old DNAt rules need to be deleted (?) and new ones added for the updated IP address of the interface in question.
- Is there some sort of callback mechanism in Linux that I can hook into, so it tells me when the IP address was changed/assigned, and I can then react to that by fixing the DNAT rules?
#1: Initial revision
Dynamic IP & lease loss - "callback" mechanism?
I'm playing with NAT, and have a script now that, among others, at startup of my little Linux machine, creates some DNAT rules, which take one incoming special port, and forward that to enother interface with a standard e.g. SSH port, so I can talk to this Linux box, from the outside, and it its copnnected 2nd box, as if it were one machine, but different ports. The interface to the outside world was, so far, configured with static IP. But it *might* need configuring for dynamic assignment. So, my simple startup bash script adding the DNAt rules with iptables, then won't work anymore: 1. it can only be called when it's clear that the interface has gotten an IP 2. the interface could lose the IP (lease) at some point - then the old DNAt rules need to be deleted (?) and new ones added for the updated IP address of the interface in question. Is there some sort of callback mechanism in Linux that I can hook into, so it tells me when the IP address was changed/assigned, and I can then react to that by fixing the DNAT rules?