LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 07-10-2007, 05:53 PM   #1
SRS
LQ Newbie
 
Registered: Jul 2007
Distribution: Slackware, Monta Vista
Posts: 4

Rep: Reputation: 0
static IP setup problem


This should be simple but it doesn't seem to work.

I'm trying to setup a simple tpc/ip network. I've got
a slackware distribution and a Belkin wireless router but I'm only using the wired ports.

First I tried DHCP but that failed. I received an offer for a good ip address but then I timed out waiting for the response to the request. So I tried just a static ip address but I still can't see anything else on the network. It appears to be a routing setup issue, I think.


My router is setup as 192.168.2.1. On my linux box I
issued the following commands:
> ifconfig eth0 192.168.2.10
> route -n
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo

> route add default gw 192.168.2.1
> route -n
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 192.168.2.1 0.0.0.0 UG 0 0 0 eth0

> ping 192.168.2.1
...Destination Host Unreachable.

What is wrong?
I have another linux (montavista) machine on the network
which works fine. It's routing table looks the same but without the 127.0.0.0 entry. From that machine I can ping 192.168.2.1. Oh, the montavista ip addr is 192.168.2.2. From my slackware machine I can't ping that either.

Oh, netstat -i always shows 0 for the eth0 tx/rx entries. It looks like it's not trying.

Sorry about the routing table format. I hope it's not too unreadable. It seems multiple spaces are colapsed into one.

Thanks,
Tom
 
Old 07-10-2007, 06:44 PM   #2
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: Tupelo, MS
Distribution: Gentoo
Posts: 6,926

Rep: Reputation: 124Reputation: 124
static IP setup in Slackware

Tom,

Welcome to LQ!

In Slackware you should setup your network by editing the file:
Code:
/etc/rc.d/rc.inet1.conf
For an example:
Code:
# /etc/rc.d/rc.inet1.conf
#
# This file contains the configuration settings for network interfaces.
# If USE_DHCP[interface] is set to "yes", this overrides any other settings.
# If you don't have an interface, leave the settings null ("").

# You can configure network interfaces other than eth0,eth1... by setting
# IFNAME[interface] to the interface's name. If IFNAME[interface] is unset
# or empty, it is assumed you're configuring eth<interface>.

# Several other parameters are available, the end of this file contains a
# comprehensive set of examples.

# =============================================================================

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

# Default gateway IP address:
GATEWAY="192.168.1.1"

# Change this to "yes" for debugging output to stdout.  Unfortunately,
# /sbin/hotplug seems to disable stdout so you'll only see debugging output
# when rc.inet1 is called directly.
DEBUG_ETH_UP="yes"
The uncommented lines (without # in front of them) are what Slackware uses. Those above are on a box on a network with has a router with the address 192.168.1.1, and a computer with the address 192.168.1.31.

In your particular example above:
Code:
# Config information for eth0:
IPADDR[0]="192.168.2.10"
NETMASK[0]="255.255.255.0"
#USE_DHCP[0]=""
#DHCP_HOSTNAME[0]=""

# Default gateway IP address:
GATEWAY="192.168.2.1"

# Change this to "yes" for debugging output to stdout.  Unfortunately,
# /sbin/hotplug seems to disable stdout so you'll only see debugging output
# when rc.inet1 is called directly.
DEBUG_ETH_UP="yes"
And the problem with your text not formatting properly, especially with numbers and symbols, is remedied by using VB code. I thought you could select that when making a post, but don't know how. I do it manually. Put [_code] without the _ (underscore) in front of your text, and [_/code] without the _ (underscore) after your text.

Edit:

The file /etc/resolv.conf is also necessary to setup your DNS servers when you run a static IP. The comp I referenced above simply has "nameserver 192.168.1.1" -- but on another box running wireless, I must enter my IP's DNS servers to use the internet.

And all this can be done in Slackware by running "netconfig" as root. If you answer the questions correctly, Slackware will setup your network. This is done when you install Slackware, unless you choose to skip it.

Last edited by Bruce Hill; 07-10-2007 at 06:49 PM.
 
Old 07-10-2007, 06:56 PM   #3
SRS
LQ Newbie
 
Registered: Jul 2007
Distribution: Slackware, Monta Vista
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks for the response Bill.

Actually I did run netconfig first. But thought the commands would be easier to explain. Using netconfig I have the same results. The only difference is that the metric field in the routing table is set to 1 or the default gateway. Also I entered the nameserver ip address. That's on the other side of the gw, I assume on some box run by my isp.

I've also tried modifying the inet1.conf. As before the same results.
 
Old 07-10-2007, 09:27 PM   #4
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: Tupelo, MS
Distribution: Gentoo
Posts: 6,926

Rep: Reputation: 124Reputation: 124
The metric field in the routing table should be set to 1 or the default gateway.
Code:
mingdao@silas:~$ /sbin/route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         192.168.1.1     0.0.0.0         UG    1      0        0 eth0
After editing /etc/rc.d/rc.inet1.conf you should issue "/etc/rc.d/rc.inet1 restart"

Do you have 192.168.2.10 allowed as a static IP in your router?

This might be helpful: LQ vB Code List
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Suse Setup Static Ip for Newbie shnippy Linux - Networking 1 06-07-2007 02:59 PM
setup the static ip address hansi umayangan Suse/Novell 1 04-04-2005 02:54 AM
SuSE 9.0 and 9.2 Static IP Setup ? frank-01 Linux - Networking 5 01-01-2005 06:28 PM
suse and static ip setup? caperneoignis Linux - Networking 1 07-27-2004 11:23 AM
How to setup static IP on RH8 RevDavis Linux - Networking 2 02-23-2004 04:14 AM


All times are GMT -5. The time now is 12:01 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration