Linux - Networking This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
07-04-2006, 11:28 PM
|
#1
|
|
Member
Registered: Mar 2006
Distribution: BackTrack, RHEL, FC, CentOS, IPCop, Ubuntu, 64Studio, Elive, Dream Linux, Trix Box
Posts: 310
Rep:
|
masqueraded and got internet connection, no remote access to gateway!
Hi everyone,
I tried reading some threads but did not found solution.
This is because of my lower understanding with iptables and
I wanted to share a connection in my home lan using iptables forwarding but some how packets do get forwarded ,I can use Internet connection on all my machines but I cant access the machine (gateway) remotely. I think I am directly forwording the packets destined to the machine itself and want a way to return them to the machine. RETURN has something to do with this and I cant figure it out. Can some body help me.
Quote:
[root@firebird fire]# for nameserver in `grep nameserver /etc/resolv.conf | gawk -F" " '{print $2}'`; do iptables -t nat -A PREROUTING -d 192.168.111 -j DNAT --to-destination $nameserver; echo -e " Name server defined at $nameserver"; done;
Name server defined at x.x.x.x
Name server defined at x.x.x.x
[root@firebird fire]# iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
|
Above are the commands that I fire up to get connected to the Internet but after that I just cant access the machine by any other means (SSH , webmin)
Where I am going wrong?
Thanks in advance
Aniruddha
Last edited by imagineers7; 11-12-2006 at 03:34 AM.
|
|
|
|
07-06-2006, 04:10 AM
|
#2
|
|
Senior Member
Registered: Mar 2006
Posts: 1,896
Rep:
|
If your LAN is connected to eth0, and eth1 is your Internet connection, your POSTROUTING command looks fine. (Use SNAT instead of MASQUERADE if you have a static Internet IP address.) This should not interfere with your LAN operation and you should not need any additional commands to make it work.
If you are having trouble (for example) ssh'ing into this machine from another box on your LAN, your problem is probably in your netfilter INPUT chain, or possibly OUTPUT chain. If you can't access this machine from the Internet, your problem could, again, be in the INPUT or OUTPUT chain. But if you have a router (or NAT device) between your gateway machine and the Internet, you will need to set it up for port forwarding before you can access your box from the Internet.
|
|
|
|
07-06-2006, 11:28 PM
|
#3
|
|
Member
Registered: Mar 2006
Distribution: BackTrack, RHEL, FC, CentOS, IPCop, Ubuntu, 64Studio, Elive, Dream Linux, Trix Box
Posts: 310
Original Poster
Rep:
|
Hi BlackHole54,
Thanks for your reply,
I will check it out with snat and post what happens next.
Thanks again
Aniruddha
Last edited by imagineers7; 11-12-2006 at 03:34 AM.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 09:30 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|