Network configuration, on a Debian System, is stored in /etc/network.
In this directory you’ll find :
- interfaces : this file describe your NICs according to interfaces(5) (check this man page to see how to setup the interface, fixed IP or DHCP, gateway, netmask, and so on)
- if-pre-up.d : directory with scripts which will get run before bringing up an interface
- if-up.d : directory with scripts which will get run right after bringing up an interface
- if-down.d : directory with scripts which will get run before bringing down an interface
- if-post-down.d : directory with scripts which will get run after bringing down an interface
- run/ifstate : the current state of the NICs
You’ll mostly want to tweak with the interfaces file, and probably put some scripts in the various hook directories. For example the /etc/network/if-pre-up.d is great to put the script which will setup your firewall (with iptables commands and ruleset).
Be sure to read the Debian Reference, which covers this and much more in great details.
2 thoughts on “Debian network configuration”
I’d put the firewall script in the if-pre-up.d directory – they will still work (they don’t depend on the interface being up) and will protect you from the first packet.
Thanks for the hint, I update the article !
Comments are closed.