This blog is made for Expressing My Ideas, Views, and to put some technical datas.
Monday, April 12, 2010
How to connect two systems using a ethernet cable and make one as gateway and browse internet
for sys1 :
For configuring the sys1 as the ip address of 10.0.1.1
$ sudo ifconfig eth0 10.0.1.1 netmask 255.255.255.0 broadcast 10.0.1.255
for sys2 :
For configuring the sys2 as the ip address of 10.0.1.2
$ sudo ifconfig eth0 10.0.1.2 netmask 255.255.255.0 broadcast 10.0.1.255
for sys1
siva@ubuntu:~$ /sbin/ifconfig
eth0 Link encap:Ethernet HWaddr 00:24:1d:28:93:97
inet addr:10.0.1.1 Bcast:10.0.1.255 Mask:255.255.255.0
inet6 addr: fe80::224:1dff:fe28:9397/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:73 errors:0 dropped:0 overruns:0 frame:0
TX packets:54 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:13801 (13.8 KB) TX bytes:9044 (9.0 KB)
Interrupt:253 Base address:0xa000
eth1 Link encap:Ethernet HWaddr 00:e0:5c:00:27:1f
inet addr:172.16.0.226 Bcast:172.16.255.255 Mask:255.255.0.0
inet6 addr: fe80::2e0:5cff:fe00:271f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4968 errors:0 dropped:0 overruns:0 frame:0
TX packets:5438 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3325051 (3.3 MB) TX bytes:1119263 (1.1 MB)
Interrupt:21 Base address:0xce00
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:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:240 (240.0 B) TX bytes:240 (240.0 B)
for sys1
$ siva@ubuntu:~$ sudo echo 1 > /proc/sys/net/ipv4/ip_forward
else
$ siva@ubuntu:~$ chmod +x /tmp/forward.sh
$ sudo echo 1 > /proc/sys/net/ipv4/ip_forward
$ sudo /tmp/forward.sh
siva@ubuntu:~$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth1
172.16.0.0 0.0.0.0 255.255.0.0 U 1 0 0 eth1
0.0.0.0 172.16.0.6 0.0.0.0 UG 0 0 0 eth1
Now configure ip address of 10.0.1.1 sys1 as gateway in sys2
for sys2 :
$ root@localhost.com # /sbin/rout add default gw 10.0.1.1
for sys2 :
$ ping 10.0.1.1
You have to configure your destination IP and gateway IP in the internet router. then follow the steps as
for sys2 :
$ ping 172.16.0.2
for sys2 :
$ ping www.google.com
In sys2 :
$ root@localhost.com # :~$ ping www.google.com
PING www.l.google.com (209.85.231.104) 56(84) bytes of data.
64 bytes from maa03s01-in-f104.1e100.net (209.85.231.104): icmp_seq=1 ttl=56 time=28.4 ms
64 bytes from maa03s01-in-f104.1e100.net (209.85.231.104): icmp_seq=2 ttl=56 time=28.5 ms
64 bytes from maa03s01-in-f104.1e100.net (209.85.231.104): icmp_seq=3 ttl=56 time=27.8 ms
C-c C-c
--- www.google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 27.802/28.261/28.577/0.332 ms
I think so this tutorial will be easier to configure.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment