LinuxQuestions.org
Help answer threads with 0 replies.
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 03-12-2009, 03:19 AM   #1
bharatlalgupta
Member
 
Registered: Aug 2008
Posts: 79
Blog Entries: 1

Rep: Reputation: 16
Post internet sharing problem


Hi
i'm using RHEL5 linux ,
i have a broadband connection on window but now i want use this on linux
and i want to share this internet connection with MS Window and linux Opreating system.....
so plz, tell me procedure of configuration a internet connection for local PC and sharing it..
on window and linux...
 
Old 03-12-2009, 05:08 AM   #2
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,224

Rep: Reputation: 132Reputation: 132
your post is little bit unclear whether you are asking about physical connection of each PCs or network configuration

network configuration for linux (this is static ip configuration method)
#vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=172.16.8.154
NETMASK=255.255.0.0
GATEWAY=172.16.100.25

#vi /etc/resolv.conf
nameserver 172.16.121.50
nameserver 172.16.121.60
change ips according to your network
#service network restart ;after modify the ips restart the network services

# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 172.16.100.25 0.0.0.0 UG 0 0 0 eth0
makesure your default gateway

#ping yahoo.com
64 bytes from w2.rc.vip.re4.yahoo.com (206.190.60.37): icmp_seq=1 ttl=49 time=309 ms
64 bytes from w2.rc.vip.re4.yahoo.com (206.190.60.37): icmp_seq=2 ttl=49 time=309 ms
if this ping replay that means you have sucessfully configured network

if your broadband router enabled dhcp service(most of the routers having dhcp service) ,it will supply ip for your pcs

Last edited by kirukan; 03-12-2009 at 05:11 AM.
 
Old 03-12-2009, 05:31 AM   #3
ddaemonunics
Member
 
Registered: May 2008
Location: Romania
Distribution: Debian
Posts: 242

Rep: Reputation: 41
if that's the case

provider---------linux-box(as gateway)----------client1 (windows)


the I suppose your linux-box has 2 network interfaces
eth0 - provider IP netmask gateway and name server
eth1- 192.168.0.1 255.255.255.0
default gateway is that from your provider



enable ip_forward in /etc/sysctl.conf or echo "1" > /proc/sys/net/ipv4/ip_forward

in iptables enable masquerade
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

on client
IP 192.168.0.7 netmask 255.255.255.0 gateway 192.168.0.1 nameserver provider

test conectivity from client to linux-box (ping 192.168.0.1)
test conectivity from client to provider gateway(ping provider gateway)

Last edited by ddaemonunics; 03-12-2009 at 05:33 AM.
 
Old 03-28-2009, 05:40 PM   #4
Zeusz3
LQ Newbie
 
Registered: May 2008
Distribution: Debian 4.0
Posts: 17

Rep: Reputation: 0
hello, am trying to do a similart setup but there is somethings that am not doing right and it ain't working
ISP---->box1------>box2

box1 runs debian etch and has the following setup
eth0 is connected to box2 (ip 192.168.0.1)
eth1 is connected to the internet (DHCP) (internet works fine, but i can't ping box2 neither can box2 ping box1)
here are the results of
1- route

Kernel IP routing table
Destination------Gateway---------Genmask---------Flags-Metric-Ref---Use Iface
192.168.0.0------0.0.0.0--------255.255.255.0----U-----0------0-------0-eth0
147.102.132.0---0.0.0.0---------255.255.252.0----U-----0------0-------0-eth1
0.0.0.0--------147.102.132.200--0.0.0.0----------UG----0------0-------0-eth1
-------------------------------------------------------------------------------

2- ping -c 2 192.168.0.2

PING 192.168.0.2 (192.168.0.2) 56(84) bytes of data.
From 192.168.0.1 icmp_seq=1 Destination Host Unreachable
From 192.168.0.1 icmp_seq=2 Destination Host Unreachable

--- 192.168.0.2 ping statistics ---
2 packets transmitted, 0 received, +2 errors, 100% packet loss, time 1009ms
, pipe 2
-------------------------------------------------------------------------------


3- i have the following in my /etc/network/if-up.d saved under the name 00-firewall.sh

iTH=/usr/sbin:/sbin:/bin:/usr/bin

#
# delete all existing rules.
#
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X

# Always accept loopback traffic
iptables -A INPUT -i lo -j ACCEPT


# Allow established connections, and those not coming from the outside
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -m state --state NEW -i ! eth1 -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT

# Allow outgoing connections from the LAN side.
iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT

# Masquerade.
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

# Don't forward from the outside to the inside.
iptables -A FORWARD -i eth1 -o eth1 -j REJECT

# Enable routing.
echo 1 > /proc/sys/net/ipv4/ip_forward
--------------------------------------------------------------------------------------

4- ifconfig

eth0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:192.168.0.1 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::20f:b5ff:fef5:ea42/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:79 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:9860 (9.6 KiB)
Interrupt:11 Base address:0x6000

eth1 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:147.102.132.xx Bcast:147.102.135.255 Mask:255.255.252.0
inet6 addr: fe80::21a:4dff:fe5a:d73d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:30614 errors:0 dropped:0 overruns:0 frame:0
TX packets:6160 errors:0 dropped:0 overruns:0 carrier:0
collisions:1230 txqueuelen:1000
RX bytes:5032762 (4.7 MiB) TX bytes:846979 (827.1 KiB)
Interrupt:10 Base address:0xc800

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:26 errors:0 dropped:0 overruns:0 frame:0
TX packets:26 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2296 (2.2 KiB) TX bytes:2296 (2.2 KiB)

===============================================================================

box2 also uses debian etch and has the following setup
eth0 connected to box1 (ip 192.168.0.2)
results of:

1- route
Kernel IP routing table
Destination - Gateway - Genmask - Flags -Metric- Ref - Use Iface
192.168.0.0 - 0.0.0.0 - 255.255.255.0 - U - 0 - 0 - 0-eth0
default - 192.168.0.1 - 0.0.0.0 - UG - 0 - 0 - 0-eth0
--------------------------------------------------------------------------------------------

2- ping -c 2 192.168.0.1

PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
From 192.168.0.2 icmp_seq=1 Destination Host Unreachable
From 192.168.0.2 icmp_seq=2 Destination Host Unreachable

--- 192.168.0.1 ping statistics ---
2 packets transmitted, 0 received, +2 errors, 100% packet loss, time 1000ms
, pipe 2
------------------------------------------------------------------------------------------

3- no iptables running



how can i share the internet connection on box1 with box2?
 
  


Reply

Tags
internet, sharing


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
problem sharing internet cellfedora Linux - Networking 1 01-03-2007 10:25 AM
Problem sharing internet.... lingeek Linux - Networking 5 09-03-2005 12:26 AM
problem sharing internet... lingeek Fedora 1 09-02-2005 06:42 PM
Sharing internet problem johnlittlepeap Linux - Networking 1 10-24-2004 12:32 AM
Internet sharing problem matux Linux - Networking 6 07-14-2004 08:06 AM


All times are GMT -5. The time now is 01:58 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration