LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 08-28-2012, 02:39 AM   #1
drpaudel
LQ Newbie
 
Registered: Mar 2008
Posts: 15

Rep: Reputation: 0
Getting problem in Static Routing in Debian


I am newbie to Linux networking.
I have 2 NICs in Debian host. eth0 is running DHCP and its setting is
Code:
allow-hotplug eth0
iface eth0 inet dhcp
eth1 is running in static IP and setting is as below

Code:
auto eth1
iface eth1 inet static
address 192.168.0.1
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
Problem
eth0 is getting dynamic IP and internet is okay.

I am connecting my Client PC via eth1 having IP 192.168.0.2 Now I need to add proper route. Where and what shall I require to add route in order to access internet service in my Client PC. Is there anything more remaining things to be done.
 
Old 08-28-2012, 11:13 AM   #2
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,281

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
To enable routing you need to make a command
Code:
echo 1 > /proc/sys/net/ipv4/ip_forward
But with your configuration you also need a NAT. Because addresses 192.168.*** will not be routed to Internet, it is for private local networks. For enabling NAT, you need to add iptables rule:
Code:
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
And FORWARD ACCEPT rules in filter table if you use it. By default, I think, all is accepted - you should change this if you have other connected clients you want to not be routed. These commands need to be executed after every boot, so write them on starting script, for example /etc/rc.local.
 
1 members found this post helpful.
Old 08-29-2012, 03:01 AM   #3
drpaudel
LQ Newbie
 
Registered: Mar 2008
Posts: 15

Original Poster
Rep: Reputation: 0
Thanks

It work fine. Thank you eSelix
 
  


Reply

Tags
internet connection, sharing, static route



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
Dynamic routing isn't done; static routing works for about 2 seconds for wireless gregorian Linux - Networking 7 02-19-2010 06:43 AM
Two interfaces routing problem, Debian, kernel 2.4 clintp Linux - Networking 4 10-31-2008 12:24 AM
Debian 3 NIC static routing table crashsystems Linux - Networking 3 11-09-2006 12:58 AM
Static Routing Problem kewlemer Linux - Networking 3 07-02-2006 05:56 PM
routing problem with 2 static (external) IPs gjmwalsh Linux - Networking 3 05-23-2004 09:17 PM

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

All times are GMT -5. The time now is 07:36 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