View previous topic :: View next topic |
Author |
Message |
mrbrklyn n00b
Joined: 05 Oct 2017 Posts: 8
|
Posted: Sat Oct 07, 2017 10:02 am Post subject: iptables configuration |
|
|
I want to ditch network manager and put in a static network config
I set up things in /etc/conf.d/net
Now I need to put in a simple iptable command for masquarading and I don't see how it fits within the complex /etc/init.d/iptables configuration.
I have to create a rule and then save it, but I don't see where or docs on the form of the file
/usr/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Also, I don't see how to turn on port forwarding. |
|
Back to top |
|
|
charles17 Advocate
Joined: 02 Mar 2008 Posts: 3685
|
|
Back to top |
|
|
szatox Advocate
Joined: 27 Aug 2013 Posts: 3495
|
Posted: Sat Oct 07, 2017 1:35 pm Post subject: |
|
|
IPv4 forwarding in runtime:
sysctl net.ipv4.conf.all.forwarding=1
IPv6 forwarding in runtime:
sysctl net.ipv6.conf.all.forwarding=1
To make it persistent, put params from those commands above into a config file you can find in /etc (so they will be loaded on every boot)
Gentoo comes with iptables service. It has a non-standard command "save", which dumps current rules to a file somewhere in /var/lib, and loads those rules back when the service starts, which makes a pretty nice and easy to use interface. You just set your rules manually, and once you're happy with them, you use 'service iptables save' to make them permanent. |
|
Back to top |
|
|
pjp Administrator
Joined: 16 Apr 2002 Posts: 20588
|
Posted: Sat Oct 07, 2017 3:01 pm Post subject: |
|
|
Moved from Other Things Gentoo to Networking & Security. _________________ Quis separabit? Quo animo? |
|
Back to top |
|
|
mrbrklyn n00b
Joined: 05 Oct 2017 Posts: 8
|
Posted: Sat Oct 07, 2017 6:47 pm Post subject: |
|
|
that is not useful. I already know everything there. I need to set it up on boot with openrc and no Network Manager et al |
|
Back to top |
|
|
mrbrklyn n00b
Joined: 05 Oct 2017 Posts: 8
|
Posted: Sat Oct 07, 2017 6:48 pm Post subject: |
|
|
szatox wrote: |
To make it persistent, put params from those commands above into a config file you can find in /etc (so they will be loaded on every boot)
|
that is my question. How do I do that. |
|
Back to top |
|
|
mrbrklyn n00b
Joined: 05 Oct 2017 Posts: 8
|
Posted: Sat Oct 07, 2017 6:51 pm Post subject: |
|
|
szatox wrote: | IPv4 forwarding in runtime:
sysctl net.ipv4.conf.all.forwarding=1
IPv6 forwarding in runtime:
sysctl net.ipv6.conf.all.forwarding=1
To make it persistent, put params from those commands above into a config file you can find in /etc (so they will be loaded on every boot)
Gentoo comes with iptables service. It has a non-standard command "save", which dumps current rules to a file somewhere in /var/lib, and loads those rules back when the service starts, which makes a pretty nice and easy to use interface. You just set your rules manually, and once you're happy with them, you use 'service iptables save' to make them permanent. |
Oh. I was wondering because there are a bunch of files in that sub directory that seem to need entries |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 23091
|
Posted: Sat Oct 07, 2017 11:25 pm Post subject: |
|
|
The persistent sysctl file szatox hinted at has a very subtle name: /etc/sysctl.conf. Put the settings there. Ensure that rc service sysctl is in the boot runlevel. That will enable IP packet forwarding for IPv4/IPv6, as appropriate. Separately, you may need iptables rules if the forwarded traffic needs to be rewritten. |
|
Back to top |
|
|
|