Forums

Skip to content

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

Minimalistic MASQURADE rules

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
3 posts • Page 1 of 1
Author
Message
deribin
n00b
n00b
Posts: 71
Joined: Mon Feb 03, 2003 9:06 am
Location: Prague

Minimalistic MASQURADE rules

  • Quote

Post by deribin » Sat Apr 21, 2007 3:34 pm

Hi!

Simple question. I'm using my gentoo-box as home router and for the really long time I have only one rule for my iptables:
-A POSTROUTING -o eth0 -j MASQUERADE
It it's fair enough for me. But after one updates few days ago something were changed and now it doesn't work. I.e.: I can ping any site from internal network, but can't ssh, or browse web from internal network.
kernel: 2.6.21-rc6-mm1
iptables: v1.3.5

What I have missed?

PS: I do not want to set up any complicate firewall rules, just need MASQUERADE.

Thank you!
Top
texas1emt
Guru
Guru
User avatar
Posts: 352
Joined: Mon Oct 27, 2003 6:18 am
Location: San Antonio, TX
Contact:
Contact texas1emt
Website

  • Quote

Post by texas1emt » Thu May 10, 2007 11:54 pm

There are a few things you can check. First, make sure you are set up to forward ipv4 packets:

Code: Select all

# cat /proc/sys/net/ipv4/ip_forward
1
If this returns anything other than 1, this may be your problem. You can correct it with:

Code: Select all

# echo 1 > /proc/sys/net/ipv4/ip_forward
Then make sure it comes up that way at boot time by adding this line to your /etc/sysctl.conf:

Code: Select all

net.ipv4.ip_forward = 1
If it's already set to 1, make sure your original iptables rule is still present. For example, here's mine:

Code: Select all

# iptables -t nat -vnL POSTROUTING
Chain POSTROUTING (policy ACCEPT 13920 packets, 2416K bytes)
 pkts bytes target     prot opt in     out     source               destination         
52179 4840K MASQUERADE  all  --  *      eth0    0.0.0.0/0            0.0.0.0/0
If it's not present, just add it in again:

Code: Select all

# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Of course, replace eth0 with your external network interface, then run /etc/init.d/iptables save to change the changes for the next bootup.
M. Hayden - San Antonio, TX
Top
deribin
n00b
n00b
Posts: 71
Joined: Mon Feb 03, 2003 9:06 am
Location: Prague

  • Quote

Post by deribin » Fri May 11, 2007 12:31 am

That's it.
Thank you for replay.


Actually my problem was not in iptables, but in ethernet (I have to use sky2 module with my adapter). Support for this hardware still broken and behavior is really strange. In my case it was MTU, which was dropped from 1500 to 560 when adapter hangs. Solution is to set MTU manually after adapter re-initialization.

But, even with wrong MTU, you can push masquerade to work, using:

Code: Select all

-A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
That is what put me to the wrong way.

Maybe it will help somebody who will meet same problem.
Top
Post Reply

3 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