Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I use Fedora 7 and my /etc/sysconfig/iptables is as follows
Quote:
# Firewall configuration written by system-config-securitylevel
# Manual customization of this file is not recommended.
*filter
:FORWARD ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT - [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p 50 -j ACCEPT
-A RH-Firewall-1-INPUT -p 51 -j ACCEPT
-A RH-Firewall-1-INPUT -i ppp1 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -d 224.0.0.251 --dport 5353 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m state -m udp --dport 51115 --state NEW -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state -m tcp --dport 51115 --state NEW -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m state -m udp --dport 9176 --state NEW -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state -m tcp --dport 9176 --state NEW -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m state -m udp --dport 1090 --state NEW -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state -m tcp --dport 1090 --state NEW -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state -m tcp --dport 2425 --state NEW -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m state -m udp --dport 2425 --state NEW -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state -m tcp --dport 80 --state NEW -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state -m tcp --dport 443 --state NEW -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Generated by webmin
*mangle
:FORWARD ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
-A PREROUTING -i ppp1 -j MARK --set-mark 0x9
COMMIT
# Completed
# Generated by webmin
*nat
:OUTPUT ACCEPT [0:0]
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
-A POSTROUTING -m mark -j MASQUERADE --mark 0x9
COMMIT
# Completed
now my interface connected to internet is ppp0
interface between my phone and computer is ppp1 (using bluetooth and DUN)
i want the phone to access internet through ppp0 . The above firewall config worked for me in FC5 , but it refusing to work in Fedora7. Please help....
I also ran the following command before trying to connect
Oh yeah, the redhat firewall... note: sudo iptables -L usually gives easier to read information.
... what you have is (apparently) a default accept policy for everything (bad), but all inputs get sent to the redhat defined chain (puzzling, but allows for more elaborate firemalls with extra chains). The redhat chain goes on to accept pretty much everything.
The firewall is too complicated to check easily, and it is a wonder it stops anything at all.
Thanks Simon, the script worked really well. Though If you have the time, can anyone tell me what was wrong in the earlier setup i was trying !?
-A PREROUTING -i ppp1 -j MARK --set-mark 0x9
COMMIT
# Completed
# Generated by webmin
*nat
:OUTPUT ACCEPT [0:0]
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
-A POSTROUTING -m mark -j MASQUERADE --mark 0x9
I believe that the problem was in applying the masquerade rule to the interface on the lan side of your firewall machine. You could try running the same rule set, with "ppp1" on the first line I copied changed to "ppp0", your internet interface, if you want to identify the problem. There may be other problems, but that looks like a necessary change to get your previous script to work.
Yep... it had to be something like that.
If the original script was just copied over there wouldn't have been a problem. But it looks like you were doing it from memory or notes rather than backup.
It is very easy to mix up the interface names like that. Another common mixup is to make a loop where two or more chains pass a packet back and forth forever.
Anyway, using (intelligently named) variables in the script is a kind of discipline which can avoid this sort of confusion.
Of course I could have just told you... I just chose to act in your best interests by solving the meta-problem first. You'll find that script very easy to understand and modify as your needs change. It also gives a more secure firewall... though you may need to explicitly open a port sometimes.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.