How to share Internet connection in centos 6...?

1,127 views
Skip to first unread message

Ankit Soni

unread,
Apr 30, 2013, 2:22:55 AM4/30/13
to vg...@googlegroups.com, shamar...@gmail.com, deep2...@gmail.com
Hi Sir

I have two system, one is laptop and second is desktop pc....
i have installed centos 6.4 in my laptop. i am accessing internet
through wifi and i want to share to my desktop machine using lan port.
how to configure it

Addition Information:-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Laptop:-
wifi:- ip 192.168.1.13
subnet-mask 255.255.255.0
Default Router 192.168.1.1
Primery DNS 192.168.1.1

lan:- ip 192.168.0.254
subnet-mask 255.255.255.0
Primery DNS 192.168.0.254
Gateway 192.168.0.254

Desktop
lan:- ip 192.168.0.1
subnet-mask 255.255.255.0
Gateway 192.168.0.254

And My firewall is running
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Thanks and Regard

Ankit Soni
(RHCSA, RHCE)
~~~~~~~~~
"Linux is immortal, its like perfume spread all over the world"
Be happy using open source.....

rajneesh kumar

unread,
May 1, 2013, 2:17:42 AM5/1/13
to vg...@googlegroups.com
Dear  Ankit

add line in iptable in
/etc/sysconfig/iptables

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
service iptables save
service iptables restart

whrere eth0 is internet interface



--
Please read http://www.catb.org/~esr/faqs/smart-questions.html before posting.
You received this message because you are subscribed to the "Vibrant GNU/Linux User Group".
To stop receiving emails from this group, mail to VGLUG+unsubscribe@googlegroups.com
To post to this group, send email to VG...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/VGLUG

--- You received this message because you are subscribed to the Google Groups "VGLUG" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vglug+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.





--
Thanks &Regards,
Rajneesh Kumar
(Simplex eSolution Pvt. Ltd.)

ElectroMech

unread,
May 1, 2013, 10:05:29 AM5/1/13
to vglug
Hi,

My suggestion is try network instead of NetworkManager.


On Tue, Apr 30, 2013 at 11:52 AM, Ankit Soni <akki...@gmail.com> wrote:
Hi Sir

I have two system, one is laptop and second is desktop pc....
i have installed centos 6.4 in my laptop. i am accessing internet through wifi and i want to share to my desktop machine using lan port. how to configure it

Addition Information:-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Laptop:-
    wifi:- ip                             192.168.1.13
            subnet-mask            255.255.255.0
            Default Router          192.168.1.1
            Primery DNS            192.168.1.1

    lan:- ip                               192.168.0.254
            subnet-mask              255.255.255.0
            Primery DNS              192.168.0.254
            Gateway                    192.168.0.254

Desktop
    lan:- ip                                192.168.0.1
            subnet-mask               255.255.255.0
            Gateway                     192.168.0.254

And My firewall is running
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Then you need to enable ip_forward 
change /etc/sysctl.conf

ip_forward = 1 

Then check ping for both destination from laptop

1. ping 192.168.1.1
2. ping 192.168.0.1

If this success, try to ping any of the live ip example 

ping 8.8.8.8 

If success

Check your dns working or not.


If this success then access internet.

Some thing goes wrong then use following command and paste the output.

traceroute, ip route, mtr etc.


 
Thanks and Regard

Ankit Soni
(RHCSA, RHCE)
~~~~~~~~~
"Linux is immortal, its like perfume spread all over the world"
Be happy using open source.....

Hope this will help you.

Thanks and Regards. 

--
--
Nilesh Vaghela
(RHCSA RHCE)
ElectroMech Corporation
Redhat Channel Partner and Training Partner
302, New York Plaza, Opp Judges Bunglow, Bodakdev, Ahmedabad
22, 1st Floor, Vardhaman Complex, Subhanpura , Baroda.
www.electromech.info

ElectroMech

unread,
May 1, 2013, 10:06:37 AM5/1/13
to vglug
Just small update.

As suggested by Mr. Rajneesh iptables POSTROUTING rule should be added.
Thanks


On Tue, Apr 30, 2013 at 11:52 AM, Ankit Soni <akki...@gmail.com> wrote:
--
Please read http://www.catb.org/~esr/faqs/smart-questions.html before posting.
You received this message because you are subscribed to the "Vibrant GNU/Linux User Group".
To stop receiving emails from this group, mail to VGLUG+unsubscribe@googlegroups.com
To post to this group, send email to VG...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/VGLUG

--- You received this message because you are subscribed to the Google Groups "VGLUG" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vglug+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Savitoj

unread,
May 1, 2013, 4:04:18 AM5/1/13
to vg...@googlegroups.com
Dear  Ankit,

I appreciate Rajneesh Kumar,

Ankit you have to do one thing more enable ip forwarding in sysctl.conf file

net.ipv4.ip_forward = 1

then Shoot the command # sysctl -q
# sysctl -p to check the enabled or not.



To stop receiving emails from this group, mail to VGLUG+un...@googlegroups.com

To post to this group, send email to VG...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/VGLUG
 
---
You received this message because you are subscribed to the Google Groups "VGLUG" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vglug+un...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 



--

Regards,

Savitoj Singh
_____________
Happy Linuxing
Open source is free, if you are free then open the source
If at first you don't succeed; call it version 1.0

Ankit Soni

unread,
May 1, 2013, 11:48:16 AM5/1/13
to vg...@googlegroups.com

If i stop firewall

Thanks & Regard

Ankit Soni
(RHCSA, RHCE)
~~~~~

"Linux is immortal, it is like perfume spread all over the world...."
Be happy using open source...

--

ElectroMech

unread,
May 2, 2013, 7:51:32 AM5/2/13
to vglug
Hi,


On Wed, May 1, 2013 at 9:18 PM, Ankit Soni <akki...@gmail.com> wrote:

If i stop firewall

Stop firewall !

The POSTROUTING rule is obviously firewall rule if you stop the rule will be flushed so want work.

You can check with

/etc/init.d/iptables status

 

Thanks & Regard

Ankit Soni
(RHCSA, RHCE)
~~~~~

Thanks and Regards.
--
--
Nilesh Vaghela
(RHCSA RHCE)
ElectroMech Corporation
Redhat Channel Partner and Training Partner
302, New York Plaza, Opp Judges Bunglow, Bodakdev, Ahmedabad
22, 1st Floor, Vardhaman Complex, Subhanpura , Baroda.
www.electromech.info

Ankit Soni

unread,
May 2, 2013, 8:05:44 AM5/2/13
to vg...@googlegroups.com
HI ElectroMech

I face this kind of problem

    when didn't get internet access when i connected with wlan0 and eth0
    but i disconnected eth0, i got internet access on my laptop

>>>>>> ping to both gateway perfectly working


1. ping 192.168.1.1
2. ping 192.168.0.1


>>>>>> when i ping 8.8.8.8 (when i connected with both device eth0 and wlan0)
[root@desktop ~]# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
From 192.168.0.254 icmp_seq=1 Destination Host Unreachable
From 192.168.0.254 icmp_seq=2 Destination Host Unreachable
From 192.168.0.254 icmp_seq=3 Destination Host Unreachable
From 192.168.0.254 icmp_seq=5 Destination Host Unreachable
From 192.168.0.254 icmp_seq=6 Destination Host Unreachable
From 192.168.0.254 icmp_seq=7 Destination Host Unreachable
^C
--- 8.8.8.8 ping statistics ---
8 packets transmitted, 0 received, +6 errors, 100% packet loss, time 7250ms
pipe 3


>>>> but when i disconnected eth0

[root@desktop ~]# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=53 time=2051 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=53 time=1052 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=53 time=278 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=53 time=301 ms
64 bytes from 8.8.8.8: icmp_seq=5 ttl=53 time=1060 ms
64 bytes from 8.8.8.8: icmp_seq=6 ttl=53 time=348 ms
^C
--- 8.8.8.8 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5613ms
rtt min/avg/max/mdev = 278.699/848.868/2051.838/633.580 ms, pipe 3


How to solve this problem.....?


Thanks and Regard

Ankit Soni
(RHCSA, RHCE)
~~~~~~~~~
"Linux is immortal, its like perfume spread all over the world"
Be happy using open source.....


ElectroMech

unread,
May 2, 2013, 10:48:15 AM5/2/13
to vglug
Hi Ankit


Can you provide the output of "ip route" command on laptop.

Thanks and Regards.
 

Tejas Barot

unread,
May 2, 2013, 10:59:33 AM5/2/13
to VGLUG

Hello,

On Thu, May 2, 2013 at 5:35 PM, Ankit Soni <akki...@gmail.com> wrote:
HI ElectroMech

I face this kind of problem

    when didn't get internet access when i connected with wlan0 and eth0
    but i disconnected eth0, i got internet access on my laptop

>>>>>> ping to both gateway perfectly working

Can you provide your Ethernet and Wi-Fi Configurations ? i.e. IP, NETMASK,GATEWAY,DNS ? 

1. ping 192.168.1.1
2. ping 192.168.0.1

If this success, try to ping any of the live ip example 

ping 8.8.8.8 

If success

Check your dns working or not.


If this success then access internet.

Some thing goes wrong then use following command and paste the output.

traceroute, ip route, mtr etc.


 
Thanks and Regard

Ankit Soni
(RHCSA, RHCE)
~~~~~~~~~
"Linux is immortal, its like perfume spread all over the world"
Be happy using open source.....

Hope this will help you.

Thanks and Regards. 

--
--
Nilesh Vaghela
(RHCSA RHCE)
ElectroMech Corporation
Redhat Channel Partner and Training Partner
302, New York Plaza, Opp Judges Bunglow, Bodakdev, Ahmedabad
22, 1st Floor, Vardhaman Complex, Subhanpura , Baroda.
www.electromech.info
--
Please read http://www.catb.org/~esr/faqs/smart-questions.html before posting.
You received this message because you are subscribed to the "Vibrant GNU/Linux User Group".
To stop receiving emails from this group, mail to VGLUG+un...@googlegroups.com
To post to this group, send email to VG...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/VGLUG
 
---
You received this message because you are subscribed to the Google Groups "VGLUG" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vglug+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
Please read http://www.catb.org/~esr/faqs/smart-questions.html before posting.
You received this message because you are subscribed to the "Vibrant GNU/Linux User Group".
To stop receiving emails from this group, mail to VGLUG+un...@googlegroups.com
To post to this group, send email to VG...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/VGLUG
 
---
You received this message because you are subscribed to the Google Groups "VGLUG" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vglug+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Thanks & Regards,
Tejas Barot
Linux Administrator,
Red Hat Certified Engineer,
Linux Blog:- http://www.tejasbarot.com
Linux Forums :- http://linuxforums.tejasbarot.com
Open Source :- http://opensource.tejasbarot.com
Facebook :-  http://www.fb.me/tejasbarot.official
Facebook Page :- http://www.fb.me/AllLinuxUsersBlog
Twitter :- https://twitter.com/imtejasbarot
LinkedIn :- http://in.linkedin.com/in/imtejasbarot

Ankit

unread,
May 3, 2013, 8:21:46 AM5/3/13
to vg...@googlegroups.com
This is My Network Configuration


Addition Information:-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Laptop:-
    wifi:- ip                             192.168.1.13
            subnet-mask            255.255.255.0
            Default Router          192.168.1.1
            Primery DNS            192.168.1.1

    lan:- ip                               192.168.0.254
            subnet-mask              255.255.255.0
            Primery DNS              192.168.0.254
            Gateway                    192.168.0.254

~~~~~~~~~~~~~~~~~~~~~~~~~~~

and i followd steps from this link: http://lindesk.com/2007/04/internet-connection-sharing-using-iptables/


Thanks and Regard

Ankit Soni
(RHCSA, RHCE)
~~~~~~~~~
"Linux is immortal, its like perfume spread all over the world"
Be happy using open source.....


ElectroMech

unread,
May 3, 2013, 7:43:29 AM5/3/13
to vglug
Hi Ankit,

I think there is some issue with google new interface, it is not maintaining proper comment and readable.

But any way

On Fri, May 3, 2013 at 5:51 PM, Ankit <akki...@gmail.com> wrote:
This is My Network Configuration


Addition Information:-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Laptop:-
    wifi:- ip                             192.168.1.13
            subnet-mask            255.255.255.0
            Default Router          192.168.1.1
            Primery DNS            192.168.1.1

    lan:- ip                               192.168.0.254
            subnet-mask              255.255.255.0
            Primery DNS              192.168.0.254
            Gateway                    192.168.0.254


MOstly your problem is you have specified gateway in both the interfaces.

Just configur gateway to wifi not to lan-ip, remove any gateway or DNS to lan-ip.

Will work

Let us know,
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~

and i followd steps from this link: http://lindesk.com/2007/04/internet-connection-sharing-using-iptables/


Thanks and Regard

Ankit Soni
(RHCSA, RHCE)
~~~~~~~~~
"Linux is i


Thanks and Regards.
--
--
Nilesh Vaghela
(RHCSA RHCE)
ElectroMech Corporation
Redhat Channel Partner and Training Partner
302, New York Plaza, Opp Judges Bunglow, Bodakdev, Ahmedabad
22, 1st Floor, Vardhaman Complex, Subhanpura , Baroda.
www.electromech.info
Reply all
Reply to author
Forward
0 new messages