Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

iptables configuration

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
8 posts • Page 1 of 1
Author
Message
mrbrklyn
n00b
n00b
Posts: 8
Joined: Thu Oct 05, 2017 2:20 am

iptables configuration

  • Quote

Post by mrbrklyn » Sat Oct 07, 2017 10:02 am

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.
Top
charles17
Advocate
Advocate
Posts: 3686
Joined: Sun Mar 02, 2008 3:20 pm

  • Quote

Post by charles17 » Sat Oct 07, 2017 11:37 am

Have you seen the iptables wiki article?
Then see https://www.systutorials.com/816/port-f ... -iptables/
Top
szatox
Advocate
Advocate
Posts: 3858
Joined: Tue Aug 27, 2013 12:35 pm

  • Quote

Post by szatox » Sat Oct 07, 2017 1:35 pm

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.
Top
pjp
Administrator
Administrator
User avatar
Posts: 20668
Joined: Tue Apr 16, 2002 10:35 pm

  • Quote

Post by pjp » Sat Oct 07, 2017 3:01 pm

Moved from Other Things Gentoo to Networking & Security.
Quis separabit? Quo animo?
Top
mrbrklyn
n00b
n00b
Posts: 8
Joined: Thu Oct 05, 2017 2:20 am

  • Quote

Post by mrbrklyn » Sat Oct 07, 2017 6:47 pm

charles17 wrote:Have you seen the iptables wiki article?
Then see https://www.systutorials.com/816/port-f ... -iptables/
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
Top
mrbrklyn
n00b
n00b
Posts: 8
Joined: Thu Oct 05, 2017 2:20 am

  • Quote

Post by mrbrklyn » Sat Oct 07, 2017 6:48 pm

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.
Top
mrbrklyn
n00b
n00b
Posts: 8
Joined: Thu Oct 05, 2017 2:20 am

  • Quote

Post by mrbrklyn » Sat Oct 07, 2017 6:51 pm

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
Top
Hu
Administrator
Administrator
Posts: 24401
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Sat Oct 07, 2017 11:25 pm

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.
Top
Post Reply

8 posts • Page 1 of 1

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic