Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have installed CentOS 6.2 on HP Proliant server. I want to share my USB wireless internet (Tata photon +).

I am able to start internet on my server, but when I enable my LAN, I don't have internet access anymore. Also I am not able to share my server's internet to other Windows 7 computers.

How can I share my connection?

share|improve this question

You can share the internet by configuring the Cent OS server as a NAT machine and giving private ip addresses to the LAN machines. As in your case, the USB wireless interface is ppp0 and the LAN interface is eth0 on the Cent OS server.

Step-1: Providing private ip addresses to LAN interface on Cent OS and to the other machines in the LAN.

You can give any of the following private ip addresses.

  1. Class A (10.x.x.x )
  2. Class B (172.16.x.x to 172.31.x.x)
  3. Class C (192.168.x.x)

Suppose we select Class B private subnet (netmask

Assign to eth0 of Cent OS machine statically. Similarly keep on assigning the private ip ,, and so on to the other machines in the subnet among whom you want to share the internet.

Check whether all the machines in the LAN are able to ping eth0 interface of Cent OS machine by using ping utility. From all the machines try the following command:

$ ping

If ping reply is coming then configure the next step.

Step-2: Now next step is to configure the Cent OS machine as Network Address Translator. You can use iptables to configure the Cent OS machine as NAT machine.

NOTE: Do all the below configurations using root access. By configuring the following rules you can configure the server as NAT machine:

Flush all the existing rules first:

$ iptables -F

Then give the following commands:

$ iptables --table nat --append POSTROUTING --out-interface ppp0 -j MASQUERADE
$ iptables --append FORWARD --in-interface eth0 -j ACCEPT

You have to configure the Cent OS machine so that it can forward the packets. For this you have to give following command.

$ echo 1 > /proc/sys/net/ipv4/ip_forward

Now every machine in your subnet should be able to access the internet.

share|improve this answer
Thanks for your reply. I did the changes as you told... my wireless interface is CDMA (ttyUSB0) so I put ptables --table nat --append POSTROUTING --out-interface ttyUSB0 -j MASQUERADE I tried using eth0/eth1 .. but I am not getting the internet on windows machine... I am something wrong??? – Gaurish Apr 6 '12 at 13:20
ttyUSB0 is not the correct interface which I am talking about. Use ifconfig command to know the exact interface. It might be interface like eth0,eth1 .... or wlan0, wlan1,....I think in your case, since you are using wireless modem, it should be something like ppp0,ppp1,... – pradeepchhetri Apr 7 '12 at 16:01
@Gaurish: I have edited my answer. Please try and if not successful, then you can comment. – pradeepchhetri Apr 7 '12 at 16:02
Hi Pradeep,I did it as ppp0.. in my case.But I don't seem any changes, still it is not sharing the internet. here is my settings as below, – Gaurish Apr 9 '12 at 6:57
@Gaurish: I have edited the whole answer again. Try doing the steps mentioned in the edited answer one by one. Move to step 2 only if first step is done. In case it still don't work, comment again :) – pradeepchhetri Apr 9 '12 at 7:32

I did it as ppp0… in my case. But I don't seem any changes, still it is not sharing the internet. Here is my settings as below, file path: /etc/sysconfig/network-scripts/ifcfg-eth0


I have connected tata photon+ to usb. I need to disable the eth0 to use the internet from my wireless modem.

share|improve this answer

Your gateway and ip address are the same :

You can have a different gateway say but make sure all the other devices you share this connection with have the ip address as their gateway.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.