LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   LAN and static IPs again. (http://www.linuxquestions.org/questions/slackware-14/lan-and-static-ips-again-4175452708/)

stf92 03-04-2013 05:43 PM

LAN and static IPs again.
 
Hi: My ISP gives me DHCP. I have two computers connected in LAN. The cable modem is connected to the coaxial cable provided by the ISP and to a router. From this, one cable goes to one computer and another to the other computer. Until today I had internet in both computers and each computer talked to the other one. The relevant files contents were (one computer shown):

/etc/rc.d/rc.inet1.conf:
Code:

# Config information for eth0:
IPADDR[0]="192.168.0.2"
NETMASK[0]="255.255.255.0"
USE_DHCP[0]=""
DHCP_HOSTNAME[0]=""

# Default gateway IP address:
GATEWAY="192.168.0.1"

This one maybe is not relevant but I list it anyways:
/etc/hosts:
Code:

127.0.0.1                localhost
192.168.0.2            server.DN1 server
192.168.0.3            local.DN2  local

OK. As I have determined to switch to another company, today the technician from the new ISP came and made the new installation. So the cable modem is a new one. When the serviceman left, I had windows with internet in both machines. As to Linux, I thought I had not anything to touch. But I could not connetct to the internet. Notice how, in the setup, I had chosen static IPs for the two machines. In this new scenario, what I did was to write a new /etc/rc.d/rc.inet1.conf:
Code:


# Config information for eth0:
IPADDR[0]=""
NETMASK[0]=""
USE_DHCP[0]="yes"
DHCP_HOSTNAME[0]=""


# Default gateway IP address:
GATEWAY="192.168.0.1"

And now I have internet. But this is only a provisional rc.inet1.conf, so that I can post the present post. I arrived at the old software setup after many days of reading information sources, and trial and error. Furthermore, that setup was working. So, I do not want to change it.

The (static) IPs, 192.168.0.2 and 192.168.0.3 for the machines were arbitrarily chosen by me, within the allowed range. And the gateway has still to be 192.168.0.1. No need to change these. The file /etc/hosts only assigns names to IPs. Perhaps running netconfig again? What does netconfig do, apart from writing a new /etc/hosts and running ifconfig. By the way, at present ifconfig gives:
Code:

root@server:/etc/rc.d# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.100  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::922b:34ff:feb8:78cf  prefixlen 64  scopeid 0x20<link>
        ether 90:2b:34:b8:78:cf  txqueuelen 1000  (Ethernet)
        RX packets 664  bytes 325273 (317.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 762  bytes 122005 (119.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 42  base 0x2000 

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 16436
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 8  bytes 480 (480.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 8  bytes 480 (480.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@server:/etc/rc.d#

This is the state as of this writing, i.e., with internet connectivity. Could you tell me what is the thing I am omitting?

Alien Bob 03-04-2013 05:51 PM

Apparently your old router had a network IP range or 192.168.0.0/255.255.255.0 while the new router has 192.168.1.0/255.255.255.0.
Therefore your old configuration with static IP addresses and a gateway address of 192.168.0.1 would not get your traffic across the router.
That new router obviously is running a DHCP server and you should learn how to configure it so that it will give each computer its own permanent IP address (based on MAC address).

Really, using DHCP is the safest and easiest way to provide network connectivity out of the box.

If you want to stick to static IP's, just change the third tuple from "0" to "1". I am assuming that the new default gateway is "192.168.1.1" but that does not show from your post. Try running "route -n" to find out what the router's default gateway address is and add that to your computers' rc.inet1.conf files.

And finally, start reading the fine manuals please. You will certainly profit from a reading bit of network basics.

Eric

Kustom42 03-04-2013 05:52 PM

Did you login to your new router and assign the static IP reservations? thats your problem, the router wants to use DHCP to assign a random IP and the system wants to use a specific one. The router won't let it use a specific one unless it has a reservation for that MAC address.

Just do a quick google on your router model number and static IP reservations. It took me about 20 seconds to set up on my Cisco router at home.


All times are GMT -5. The time now is 04:35 PM.