How do I share internet with Windows from my Linux box?

I have a Linux (Ubuntu 12.04) computer attached to the net with a Greenpacket WiMax USB modem. I intend to share the Internet link with an additional computer system running Windows 7 Home Premium, attached to the Linux Computer over a LAN. Is this feasible? Just how? Is the reverse feasible rather (attaching the net to the Windows computer system and also sharing it with Linux)?

2022-06-07 14:39:39
Source Share
Answers: 2

The question asks,

Is the reverse possible instead (connecting the Internet to the Windows computer and sharing it with Linux)?

Here's how you can share your Internet connection from Windows to Linux.

On Windows,

  • Make sure internet sharing is enabled.

    • Go to Control Panel, find the network connection, then right-click on the internet adapter and click "Properties".
    • Click "Advanced".
    • Right there click the radio button to enable Internet sharing.
  • On Windows 7:

    • Go to Control Panel → "Network and Sharing Center". (You may need to go through "Network and Internet" to get there.)
    • Clink on "Change adapter settings".
    • Right-click on the network adapter and click "Properties". Enter an administrator password, if asked.
    • Click on the "Sharing" tab and enable sharing.

On Linux,

With root (sudo or su) privilege,

  1. Type this to set the default gateway:

    route add default gw x.x.x.x

    (Note: replace x.x.x.x by the Windows host's local IP address. You can find it by typing: ipconfig -all in the Windows Command Prompt.)

  2. Next type this to set the DNS:

    echo "nameserver y.y.y.y" > /etc/resolv.conf

    (Note: replace y.y.y.y by the DNS server address on Windows. You can find it by typing: ipconfig -all in the Windows Command Prompt.)

In this scenario, Windows is already connected to the Internet. After all the setup, you can try now to use the Internet from Linux. The Linux and Windows hosts should be able to use the Internet simultaneously.

2022-07-05 23:23:47

You require to set up NAT on the Linux box. There are countless howtos on the Net when you look for NAT and also iptables, possibly consisting of the distro you make use of. Below is a howto for Debian which needs to work with various other distros too:

Here are some lines that originate from a German Ubuntu howto:

sysctl -w net.ipv4.ip_forward=1
iptables -A FORWARD -o eth0 -s -m conntrack --ctstate NEW -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Put them someplace, where they are implemented at start-up (/ etc/rc. neighborhood or you placed "up" before every line and also placed the entire point right into/ etc/network/interfaces) and also change eth0 by the network tool that attaches to the Internet and also eth1 by the one that mosts likely to your LAN.

You could additionally need to inform your Windows box some name web servers (DNS) by hand if you do not intend to set up bind on your Linux box. And also I trust you do not require or currently have a DHCP web server in your LAN.

2022-06-07 15:09:45