LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-02-2015, 03:40 PM   #1
xtansat
LQ Newbie
 
Registered: May 2015
Posts: 10

Rep: Reputation: Disabled
Angry masquerading and network configuration


Hi all,
i am try to share internet on two different LANs using masquerading.
here are the details of my setup:
i have one server(name server1) have CentOS-7.i want to configure it as router. it has three interfaces
eth0: is connected with internet router that have IP address 192.168.0.1/24, here are the configuration of eth0
IP address: 192.168.0.100/24
default Gateway: 192.168.0.1
default DNS: 192.168.0.1

eth1: connected with network 10.0.0.0/8
ip: 10.0.0.1
default Gateway: 10.0.0.1
default DNS: 192.168.0.1

eth2: connected with network 172.16.0.0/16
ip: 172.16.0.1
default Gateway: 172.16.0.1
default DNS: 192.168.0.1
********************************************
on server1 i perform following steps:
Step 1: enable port forwarding
echo 1 > /proc/sys/net/ipv4/ip_forwarding
Step 2: firewall-config and enable masqurading by clicking on check box.
*********************************************
Problem Description:
i can not access internet from clients both on LAN1 and LAN2.
when i check internet is also not working on server1.
when i try to ping 8.8.8.8 i get following error message.

From 172.16.0.1 icmp_seq=1 Destination Host Unreachable
From 172.16.0.1 icmp_seq=2 Destination Host Unreachable
From 172.16.0.1 icmp_seq=3 Destination Host Unreachable

****************************************************
if i disable both eth1 and eth2 then internet start working.
 
Old 11-02-2015, 04:33 PM   #2
wildwizard
Member
 
Registered: Apr 2009
Location: Oz
Distribution: slackware64-14.0
Posts: 875

Rep: Reputation: 282Reputation: 282Reputation: 282
You can only have 1 default gateway, remove the extra gw settings on the lan side.
 
1 members found this post helpful.
Old 11-02-2015, 05:27 PM   #3
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
To elaborate on wildwizard's answer,
Quote:
From 172.16.0.1 icmp_seq=2 Destination Host Unreachable
means that the server wants to route 8.8.8.8 packets via eth2, not eth0 as intended. When you check your routing table (ip route command), you will probably see several defaults, which causes confusion. How is the system to know which default to use?
 
1 members found this post helpful.
Old 11-02-2015, 06:47 PM   #4
xtansat
LQ Newbie
 
Registered: May 2015
Posts: 10

Original Poster
Rep: Reputation: Disabled
Hi Thank you for your help, will you please advise how to set it to eth0.
Best Regards,
Tanveer Akhter Satti
 
Old 11-02-2015, 06:51 PM   #5
xtansat
LQ Newbie
 
Registered: May 2015
Posts: 10

Original Poster
Rep: Reputation: Disabled
hi wildwizard,
please advise that it is ok that i set default gateway 192.168.0.1 for all interfaces
Best Regards
 
Old 11-03-2015, 01:45 AM   #6
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
You just leave the GATEWAY clause out of the config files for eth1 and eth2. I.e. you don't configure a gateway for them. See also the Red Hat networking guide.
 
1 members found this post helpful.
  


Reply

Tags
internet connection, linux, masquerading


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
network card & masquerading mjhvg Linux - Networking 4 03-13-2009 11:39 AM
ifconfig configuration changes are not reflected in the network configuration GUI nkd Linux - Networking 4 12-25-2008 01:17 PM
Sendmail masquerading configuration Raidmax Slackware 2 04-14-2007 01:47 PM
Slackware 10 network configuration. Problem with 8139 network card drivers ! Padmakiran Linux - Networking 8 03-27-2007 06:48 AM
Can't find the sub-network using IP Masquerading Milkman00 Linux - Networking 7 03-06-2004 05:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:02 AM.

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