# Home Network Setup... [solved]

## loosing_sanity

I would like to find someone to assist me in setting up my home network.  I'm trying to learn (and understand how it works) and would like a "Mentor" to help me through it.  So far, I have a computer with 2 Ethernet cards (running), and I'm serving my Printer.  I have 3 other computers I'd like to serve to for the internet and eventually emails.  It is a start and I have googled much on this subject, but have not understood everything.  So, if anyone is interested in assisting me, I'd greatly appreciate it.    :Very Happy: 

----------

## mjf55

Ok, lets do it.  Tell me about your computers: OS,,,  what you want to do with each, Internet connection type (dialup, dsl, cable), wireless, wired, do you have a router or plan to use one of your systems as one.  how do you imagine it?  My set up is like:

```

                      ___

Winxp---cat5-------->| R |

Suse----cat5-------->| O |

Gentoo--Wireless---->| U |----->DSL Modem---->Phone line

Winxp--wireless----->| T |

xbuntu--wireless---->| E |

                     | R |

Win2K---wireless---->|___|

```

 so what do you want to do today?

----------

## overpencil

I probably have a similar setup as you I have:

```

desktop -->          |switch|            | slackware | 

            |        | --> nic |                | nic -> modem

wireless router ->   |        |            |               |

```

All you really need to do is give someway for your other machines to connect to the internal nic ( whether a switch like mine or if your internal nic is wireless ) and then connect your other nic to the modem. From here just setup iptables to masquerade your outgoing connections and to forward packets between the two nics. Now you have the most basic network.  

This: http://www.gentoo.org/doc/en/home-router-howto.xml contains everything you need. You really just need to setup iptables to forward packets ( and for security to drop the ones you do not want ).

It is also easier and better lookup speed if you install a caching only dns server ( mines on the router ) and have all your internal machines use it. You can also setup a squid on the router to cache webpages for you, to speed up web browsing.

----------

## loosing_sanity

Thanks for the help!  I sure appreciate it and look forward to getting to know the networking stuff...  I've wanted to for a long time.

What I have now is:

XP Machine <<<<<<<<<<<<<<

Gentoo Machine <<<<<<<<<<< Router <<< Modem  <<< Cable  <<<

Gentoo Machine <<<<<<<<<<<

USB Printer <<< Server <<<<<<

(Gentoo very basic)  

*** I access the server via secure shell.

*** Everything right now is CAT 5

At some point in time I will get my own IP from the commercial internet provider and handle all my own system.  Hopefully!

First I think I need to make sure I have everything emerged that I need and set up one computer through the server and have it work.

XP Machine <<<<<<<<<<<<<<

Gentoo Machine <<<<<<<<<<< Router <<< Modem  <<< Cable  <<<

USB Printer <<<<<< Server <<<

Gentoo Machine <<<  

So I guess where would you like to start and what can I show you that I have on my computer.  Please include commands if you desire a output.  Some things I know but I am very basic.

Thank you so much for the help!

----------

## mjf55

l_s, lets get some naming conventions down. *Quote:*   

> XP Machine <<<<<<<<<<<<<<
> 
> Gentoo Machine (GM1)<<<<<<<<<<< Router <<< Modem <<< Cable <<<
> 
> Gentoo Machine (GM2)<<<<<<<<<<<
> ...

  Lets call this current configuration.  GM1, GM2 = Gentoo Machine 1 and 2 ; SGM3 = Server Gentoo Machine 3.

Questions for the router

-Is the router setup as a DHCP router.    

-What is it's make and model?  I will ASSUME that it is.  

-What is the IP address assigned to the router?

-What is the IP range that the router will provide on a DHCP request?

Questions for the Systems

-Is each machine assigned a valid ip address.  

-------Do a ifconfig on each gentoo machine in a root terminal.  

-------On the XP machine, open the command prompt and do a ipconfig

-------Post the IPaddress from each here.

-Post the results of cat /etc/resolv.conf from each gentoo machine.

-Does each machine have internet access?  Can you go to www.gentoo.org?

If all this works, what is it you want to do.

----------

## loosing_sanity

1)  Yes the router is setup DHCP, and the internet provider has a dynamic  IP that they assign.  The router is a US Robotics Broadband Router.

2)  The router will handle (I Believe) up to 253 IPs.  The router is 192.168.123.254.

3)  Yes, I have set each machine to its own IP (Static).

4)  So here is what I have...

GM1:

eth0      Link encap:Ethernet  HWaddr 00:11:5B:38:AD:01  

          inet addr:192.168.123.112  Bcast:192.168.123.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:1349 errors:0 dropped:0 overruns:0 frame:0

          TX packets:1155 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:778877 (760.6 Kb)  TX bytes:117491 (114.7 Kb)

          Interrupt:16 Base address:0xcc00 

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:70 errors:0 dropped:0 overruns:0 frame:0

          TX packets:70 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:4748 (4.6 Kb)  TX bytes:4748 (4.6 Kb)

# Generated by dhcpcd for interface eth0

search losaca.adelphia.net

nameserver 192.168.123.254

GM2:

eth0      Link encap:Ethernet  HWaddr 00:11:5B:66:06:4F  

          inet addr:192.168.123.117  Bcast:192.168.123.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

         RX packets:248 errors:0 dropped:0 overruns:0 frame:0

          TX packets:157 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:40137 (39.1 Kb)  TX bytes:18080 (17.6 Kb)

          Interrupt:16 Base address:0xec00 

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:76 errors:0 dropped:0 overruns:0 frame:0

          TX packets:76 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:5460 (5.3 Kb)  TX bytes:5460 (5.3 Kb)

# Generated by dhcpcd for interface eth0

search losaca.adelphia.net

nameserver 192.168.123.254

XP

Windows IP Configuration

Ethernet adapter Local Area Connection:

Connection-specific DNS Suffix .: losaca.adelphia.net

IP Address.....................................: 192.168.123.103

Subnet Mask.................................: 255.255.255.0

Default Gateway...........................: 192.168.123.254

SGM3

eth0      Link encap:Ethernet  HWaddr 00:01:03:D4:5E:22  

          inet addr:192.168.123.116  Bcast:192.168.123.255  Mask:255.255.255.0

          inet6 addr: fe80::201:3ff:fed4:5e22/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:6933 errors:0 dropped:0 overruns:1 frame:0

          TX packets:10723 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:2144124 (2.0 Mb)  TX bytes:2035508 (1.9 Mb)

          Interrupt:12 Base address:0xce80 

eth1      Link encap:Ethernet  HWaddr 00:80:C6:F9:4E:B6  

          inet addr:192.168.123.120  Bcast:192.168.123.255  Mask:255.255.255.0

          inet6 addr: fe80::280:c6ff:fef9:4eb6/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:8 dropped:0 overruns:0 carrier:8

          collisions:0 txqueuelen:1000 

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

          Interrupt:11 Base address:0xaf00 

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:730 errors:0 dropped:0 overruns:0 frame:0

          TX packets:730 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:67356 (65.7 Kb)  TX bytes:67356 (65.7 Kb)

cat /etc/resolv.conf  did not show anything.  I did have access to the Internet, but for some reason it is not there now.   I think it has something to do with emerging dnsmasq???   :Embarassed: 

Here is what I have emerged....

server_#1 ~ # emerge -vp1 --columns cups apache samba iptables dnsmasq

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild   R   ] www-servers/apache                                     [2.2.6]  USE="doc ldap ssl -debug -mpm-event -mpm-itk -mpm-peruser -mpm-prefork -mpm-worker -no-suexec (-selinux) -static-modules -threads" 0 kB 

[ebuild   R   ] net-firewall/iptables                                  [1.3.8-r1]  USE="ipv6 static -extensions -imq -l7filter" 0 kB 

[ebuild   R   ] net-dns/dnsmasq                                        [2.40]       USE="resolvconf -dbus -isc -tftp" 0 kB 

[ebuild   R   ] net-print/cups                                         [1.2.12-r2]   USE="ldap nls pam ppds samba ssl -X -dbus -jpeg -php -png -slp -tiff" 0 kB 

[ebuild   R   ] net-fs/samba                                           [3.0.27a]      USE="acl automount cups doc ipv6 ldap pam python readline swat -ads -async -caps -examples -fam -quotas (-selinux) -syslog -winbind" LINGUAS="-ja -pl" 0 kB 

Total: 5 packages (5 reinstalls), Size of downloads: 0 kB

I may have forgotten something!

Here is my rc-update...

server_#1 ~ # rc-update show

            bootmisc | boot                          

             checkfs | boot                          

           checkroot | boot                          

               clock | boot                          

         consolefont | boot                          

               cupsd |      default                  

             dnsmasq |      default                  

            hostname | boot                          

             hotplug | boot                          

            iptables |      default                  

             keymaps | boot                          

               local |      default nonetwork        

          localmount | boot                          

             modules | boot                          

            net.eth0 |      default                  

            net.eth1 |      default                  

              net.lo | boot                          

            netmount |      default                  

                 nfs |      default                  

             portmap |      default                  

           rmnologin | boot                          

               samba |      default                  

                sshd |      default                  

           syslog-ng |      default                  

             urandom | boot                          

              xinetd |      default

I think I got everything.  I may have to recompile the kernel for something as well.  Thanks for your help!

----------

## Anarcho

Here are some hints:

On your SGM3: You have two network cards which have address of the same subnet assigned. This is a thing you really shouldn't do. Here it is interesting where these two NICs are connected to at the moment. The empty /etc/resolv.conf will explain why, e.g., a ping to www.gentoo.org doesn't work. The question is, do you habe setup the SGM3 to get the IP via DHCP? If not, then you should just copy the /etc/resolv.conf from any other of your gentoo boxes and you should be fine (of course after fixing the double ip/subnet problem)

----------

## mjf55

l_s, Every thing looks good EXCEPT for SGM3 where you have 

```
SGM3

eth0 Link encap:Ethernet HWaddr 00:01:03:D4:5E:22

inet addr:192.168.123.116 Bcast:192.168.123.255 Mask:255.255.255.0

eth1 Link encap:Ethernet HWaddr 00:80:C6:F9:4E:B6

inet addr:192.168.123.120 Bcast:192.168.123.255 Mask:255.255.255.0

```

You can see that both eth0 and eth1 are going to the same router.  This will NOT work well unless they are bundled together as one, i forget the term right now.  So you need tostop one of the 2 interfaces.

Also, you do need to have information in /etc/resolv.conf on each gentoo machine.  The information is the same for all of them.

I am not familiar with dnsmasq yet.  You should have everything running, i.e. internet access on all machines.  If you update /etc/hosts on each linux mahine you can alias the internal machines to their internal ip address and you can address them by name, not just ip address.  This file is at c:\windows\system32\drivers\etc\ on your windows xp machine.

How else can I help you?

----------

## loosing_sanity

Thanks for your input Anarcho and mjf55, I value it tremendously!

What should the subnet be?  I don't understand.  eth0 in going to the router and then eth1 is intended for the service to the intranet group.  Is that not the way to do it?  Right now, eth1 is not connected to anything.  Is what you are saying is that for the intranet group I should switch to 10.0.0.0 and a 255.255.0.0 subnet?

I did recopy the resolv.conf.  As stated above, the SGM3 has its own static IP (192.168.123.116).  And now it works again, but I think that dnsmasq needs something else...

Yes I know that I can alias the machines, but I need to get the darn thing working first, don't I?  Right now I have a basic Gentoo machine and not a server.  I want to make it a server so I can learn about these things.  But I'm so confused!  :Crying or Very sad:    How can I make what I have work?  Thanks all...

----------

## loosing_sanity

UPDATE:

K, this is what I changed....

eth0      Link encap:Ethernet  HWaddr 00:01:03:D4:5E:22  

          inet addr:192.168.123.116  Bcast:192.168.123.255  Mask:255.255.255.0

          inet6 addr: fe80::201:3ff:fed4:5e22/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:1365 errors:0 dropped:0 overruns:0 frame:0

          TX packets:892 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:207402 (202.5 Kb)  TX bytes:153169 (149.5 Kb)

          Interrupt:12 Base address:0xce80 

eth1      Link encap:Ethernet  HWaddr 00:80:C6:F9:4E:B6  

          inet addr:192.168.124.254  Bcast:192.168.124.255  Mask:255.255.255.0

          inet6 addr: fe80::280:c6ff:fef9:4eb6/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:209 dropped:0 overruns:0 carrier:209

          collisions:0 txqueuelen:1000 

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

          Interrupt:11 Base address:0xaf00 

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:114 errors:0 dropped:0 overruns:0 frame:0

          TX packets:114 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:8572 (8.3 Kb)  TX bytes:8572 (8.3 Kb)

And...

resolv.conf

search losaca.adelphia.net

nameserver 192.168.123.254

I hope this is what you were talking about for my subnet?  Now, how can I get things going?  :Laughing: 

----------

## Anarcho

Here are some basics about ip networking and subnets.

Each activated NIC has a pair of settings, the IP address and the subnetmask. An IP Network describes the IP-Addresses that can be reached directly, i.e. without intermediate routers. There are different types of network, different in the number of IP addresses available. In order to distinguish in which network one IP belongs, the network mask is needed.

This works as follows: 

If you write one IP address and subnetmask in binary, it would look like this (e.g. 192.168.100.10)

11000000.10101000.01100100.00001010    (= IP 192.168.100.10)

11111111.11111111.11111111.00000000    (=Subnetmask 255.255.255.0)

Now we combine the both with a logical AND (which eliminates all positions where the subnetmask is 0) and get the network:

11000000.10101000.01100100.00000000 = 192.168.100.0

So 192.168.100.0 is our network. You get all valid IP addresses of the subnet if you take all combinations of 1/0 of the places where the subnetmask is 0 which would let us here IPs from 192.168.100.0 - 192.168.100.255.

Normaly the base IP, which means all remaining bits set to 0, is the network itself and with all bits set to 1 is the broadcast address, so these both are normaly not valid.

So when you ping a IP address the kernel calculates the networks for each configured NIC and chooses the first one which could contain the IP. So if you configured more than NIC in the same subnet it could be that packets to one IP address can go out through more than one NIC.

So, your network would need 2 different subnets. One for the server - router network, one for the server-intranet network if you want to keep these both different. Otherwise you would only need 1 network if all PCs are connected using one switch.

I hope that this can clarify some things. If not, please ask.

THe DNSMASQ is a different thing. Using this you should first elaborate which topology you really want to use.

If it is "intranet -> server -> router -> internet" than you should configure dnsmasq as a DHCP server. Then the clients , if set to use dhcp, will automaticlly be configured to use the dnsmasq DNS server.

----------

## loosing_sanity

Thanks Anarcho, That is very helpful!  If I understand correctly now, then how I set it up to utilize two ethernet cards is correct.  I made eth1 as 192.168.124.254 where eth0 is set at 192.168.123.254.   :Surprised:   I hope!

Now, the SGM3 has a static IP so that I can access it via secure shell to work on it.  It has no monitor or keyboard.  At some point I will need to change it for the cable modem (eth0 would become dhcp).  I ultimately want to have; internet >>> Modem >>> Server >>> intranet.   I won't need the router.

By the way, I have tried to configure dnsmasq but I am unsure about the settings.  Maybe I don't need it right now?  Also my resolv.conf keeps getting over written with a blank page.    :Crying or Very sad:    Do you have any idea how to fix this problem?

Thanks very much for your help!  It seems the more I goggle the more confused I get...

----------

## loosing_sanity

I got my resolv.conf problem fixed.  I found it in a google search.  Don't remember the location.  But it was here in the Gentoo Forums.

What I did is:

Edit the /etc/conf.d/net file.  Add:

dns_search=( "losaca.adelphia.net" )

dns_servers=( "192.168.123.254" )

Now it works pretty good!  Still can't get the network part working....

Looking forward to more input to resolve this process!    :Very Happy: 

----------

## loosing_sanity

Well folks, I still can not get this thing going.  I have searched the internet so much that now I'm re-reading the same things.  I think I must have the kernel compiled wrong.  Or maybe a setting in the config files is wrong.  I don't know...

I did check the ethernet card and the cable and both are working.

If I have 192.168.124.254 for the IP of the server, and 192.168.124.1 for another computer, shouldn't they at least see each other?  Do I have permission issues as well?  I followed everything I could find to set these up to no avail.  So if someone could help....  I'd really appreciate it!

Here is what I got now on the SGM3 machine:

#ifconfig

 *Quote:*   

> 
> 
> eth0      Link encap:Ethernet  HWaddr 00:01:03:D4:5E:22  
> 
>           inet addr:192.168.123.116  Bcast:192.168.123.255  Mask:255.255.255.0
> ...

 

The .conf for the kernel:

 *Quote:*   

> 
> 
> # Automatically generated make config: don't edit
> 
> # Linux kernel version: 2.6.23-gentoo-r3
> ...

 

And lspci:

 *Quote:*   

> 
> 
> 00:00.0 Host bridge: VIA Technologies, Inc. VT8363/8365 [KT133/KM133] (rev 03)
> 
> 00:01.0 PCI bridge: VIA Technologies, Inc. VT8363/8365 [KT133/KM133 AGP]
> ...

 

Thanks for your interest!

I appreciate any help, I'm about to give up...

----------

## mjf55

Don't give up....  You said  *Quote:*   

> If I have 192.168.124.254 for the IP of the server, and 192.168.124.1 for another computer

 .  What other computer.  The last layout you showed involving sgm3 was 

```
usb_printer<->sgm3<->router<->modem<->cable<->internet.
```

.

Subnets can only talk to the same subnets.  where is device 192.168.124.1?  please update your layout diagram so i can understand.

EDIT: please post the output of route from your sgm3 and 'other computer'

We WILL get this going.

----------

## loosing_sanity

Sorry for the confusion.  I just swapped a cable from the router going to one of the Gentoo machines and changed the /etc/conf.d/net eth0 setting to the IP 192.168.124.1 and tried it.  Just to test things to see if the settings I've been playing with are accomplishing anything.  I needed a test machine.  but I swapped it back.

For now, I just want to get one machine going on the "Server", to at least feel as though I accomplished something.   :Crying or Very sad:    The goal right now is to get off the router and replace it with the server.  But one at a time.  Nothing seems to work and I'm getting frustrated.  Sorry for the confusion again.

Thanks!

----------

## mjf55

I understand.  Do things work correctly if you drop eth1 on sgm3 and only use eth0 into the router, having the same subnet as all the other machines.  You should be able to surf from each system out to the net.  If you can do that, then you are almost home.  

If the above is true, you need to plug the server in place of the router.  you will need a small switch for multiple cables into the lan port of smg3 ( assume it to be 192.168.123.xxx on eth0) for each of the other machines.  Then you connect eth1 (192.168.124.xxx) , the wan port to the cable modem.  You will need to install several software packages, to NAT, DHCP, etc, which I am NOT familiar.  But we can get to that.

Just verify that a single interface on sgm3 all the same subnets, works.

----------

## loosing_sanity

OK...  Here is a bit of the messages from /var/log/messages:  I don't know what it means or how to correct it, but I sure hope someone can help me out!

 *Quote:*   

> 
> 
> net eth1: device_rename: sysfs_create_symlink failed (-17)
> 
> udev: renamed network interface eth0 to eth1
> ...

 

Thanks for looking...  Please help me!

----------

## mjf55

l_s,  from your current log, it looks like to me that you have the basic network running and you are now making SGM3 act as the router.  If so, I have yet to do it, but can see that dnsmasq is complaining about line 11 in /etc/hosts.  you should look at that.

Also, the very beginning of the post, shows a rename failure, but I cannot help on that.  Perhaps google can help.

Anyone else out there have a gentoo server running as a router help out here?

Good Luck...

----------

## loosing_sanity

Thanks for the input...  Basically I fixed the name resolution thing and the problem, of why the two computers with the same subnet mask was not seeing each other, was very basic and stupid mistake.  But I'm a noob, so I guess it is alright.  But I did not use a crossover cable.  Duh!    :Embarassed: 

I also found a website that had better info on compiling the kernel. http://gentoo-wiki.com/HOWTO_Packet_Shaping shows a very good tutorial.  I also had to make sure the /etc/resolve.conf had my new server IP for internet working.  So I got my kernel issues worked out and now I'm actually serving my home network.  Not completed, but it is working.  I want to say thanks for all the inputs and help I received.

----------

