LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-11-2013, 04:50 PM   #1
austinramsay
Member
 
Registered: Jul 2007
Posts: 277

Rep: Reputation: 31
Not getting internet connection with masquerade on iptables


I'm trying to share internet from my laptop to my t2000 server. I'm running slackware 14 on the laptop, solaris 11 on server. Laptop is connected to internet via wlan0, t2000 is connected to laptop on eth0.

I've done this on the laptop:

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

I have my laptop eth0 set at 192.168.200.105, netmask 255.255.255.0
T2000 set at 192.168.200.100, netmask 255.255.255.0, default route 192.168.200.105, and nameserver 8.8.8.8.

The thing is I have ports 22 and 80 forwarded to my server, and I can ssh into it from an outside network. But I try pinging google.com on it, and it won't reach it. I dont understand why it can't get internet access, but yet I can ssh into it and access it from outside the network. Any ideas?
 
Old 10-12-2013, 03:34 PM   #2
austinramsay
Member
 
Registered: Jul 2007
Posts: 277

Original Poster
Rep: Reputation: 31
No one?
 
Old 10-12-2013, 04:16 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,540

Rep: Reputation: 6225Reputation: 6225Reputation: 6225Reputation: 6225Reputation: 6225Reputation: 6225Reputation: 6225Reputation: 6225Reputation: 6225Reputation: 6225Reputation: 6225
Have you tried searching for info on setting NAT?

You need to use the external interface in the masquerade rule which is wlan0 in your case.

Is assume ipforwarding is enabled and you have rules to forward to eth0 since you can access the server from outside.
 
Old 10-13-2013, 03:12 AM   #4
austinramsay
Member
 
Registered: Jul 2007
Posts: 277

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by michaelk View Post
Have you tried searching for info on setting NAT?

You need to use the external interface in the masquerade rule which is wlan0 in your case.

Is assume ipforwarding is enabled and you have rules to forward to eth0 since you can access the server from outside.
wlan0 is my external? Why is that? I thought wlan0 would be my in-interface but I'll try that out. Yeah I have port 22 and 80 forwarded to 192.168.200.100 through iptables also.
 
Old 10-13-2013, 09:45 AM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,540

Rep: Reputation: 6225Reputation: 6225Reputation: 6225Reputation: 6225Reputation: 6225Reputation: 6225Reputation: 6225Reputation: 6225Reputation: 6225Reputation: 6225Reputation: 6225
Quote:
Laptop is connected to internet via wlan0
t2000 is connected to laptop on eth0.
So when looking at NAT router examples your external interface = wlan0 and internal interface is eth0. Basically besides your NAT rule you need ipforwarding enabled and a rule to forward eth0 traffic to wlan0.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
iptables: log connection after SNAT/MASQUERADE command sergey.by Linux - Networking 5 07-20-2012 10:52 AM
My IPTABLEs and Slow internet connection mpr.mktg Linux - Networking 10 04-20-2012 06:16 AM
[SOLVED] iptables? masquerade? digger86 Linux - Networking 5 06-26-2009 06:44 PM
Sharing internet connection with iptables chatmanpk Linux - Networking 2 09-27-2003 06:30 PM
Masquerade - iptables amphion Linux - Security 6 06-08-2003 10:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration