Find the answer to your Linux question:
Results 1 to 2 of 2
Hi guys, im trying to setup a very basic network with both linux and windows machines. What i have is a server running debian linux with two nics and i ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2006
    Posts
    3

    (Should Be) Basic Networking Problem


    Hi guys, im trying to setup a very basic network with both linux and windows machines. What i have is a server running debian linux with two nics and i want a cable from my modem (internet) to come in one and out of the other i want to be able to share my connection with a switch or hub to which other windows computers are connected. Heres a Diagram of what i want

    (Internet)_________LINUX SERVER____________SWITCH_________WIN PC

    WWW---------NIC1(ETH0)--NIC2(ETH1)---------SWITCH---------pc1 pc2 pc3

    Any help on how i would set this up is appreciated as right now none of my windows pcs can access the internet.
    THANKS A LOT FOR YOUR HELP!

  2. #2
    Linux Enthusiast KenJackson's Avatar
    Join Date
    Jun 2006
    Location
    Maryland, USA
    Posts
    510
    You need to do three things on your Linux PC: 1) enable routing in the kernel, 2) setup iptables for network address translation or NAT, and 3) setup the routing table.

    To enable routing, edit /etc/sysctl.conf and add or uncomment this line:
    Code:
    net.ipv4.ip_forward  = 1
    That will set it up the next time you start up, but to enable it immediately, run this:
    Code:
    echo 1>/proc/sys/net/ip_forward
    You need to select a local address range for your PCs. The most popular local address range seems to be 192.168.1.0/24. That is, the 254 IP addresses from 192.168.1.1 to 192.168.1.254.

    Your Linux PC has two NICs so it will have two IP addresses. The one connected to the modem get's a real IP address assigned by your ISP. You must assign the other one--the one that connects to your local network. Traditionally, the gateway/server/router is assigned the lowest IP address in the range.

    Setting up iptables will take some trial and error. It's best to read a little about setting up NAT. There is a lot of material available, including the documentation at netfilter.

    Hang in there. It takes a little effort to get everything setup like you want, but it's fun, and doing it gives you very valuable insight into a lot of networking issues.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •