LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-10-2008, 07:58 PM   #1
ninja master
Member
 
Registered: May 2008
Distribution: funtoo/gentoo amd64 xwrt
Posts: 412

Rep: Reputation: 31
how do i set a static ip?


my network freaked out, and setting a static ip with ifconfig would say that my ip changed to the ip i assigned, but after that it would not access the net. i would specifically like to have the computer keep its static ip after reboots.

i plan on bringing my linux server to a friends to share files, and would like to be able to point directly at the server, without guessing its ip address. thanks!
 
Old 11-10-2008, 08:08 PM   #2
niels.horn
Senior Member
 
Registered: Mar 2007
Location: Rio de Janeiro - Brazil
Distribution: Slackware64-current
Posts: 1,004

Rep: Reputation: 91
You can set your IP with netconfig or editing /etc/rc.d/rc.inet1.conf
Just fill in the values for IPADDR / NETMASK for your network card and leave USE_DHCP empty.
 
Old 11-10-2008, 08:09 PM   #3
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
You're not explaining your problem very well. Setting a static IP is trivial (once you know what configuration files to edit). However, being able to access the internet depends on a number of things including correct subnet and netmask settings, correct routing information and an available Domain Name Service.

So - you need to tell us more about how you're set up and what you want to do.
 
Old 11-10-2008, 08:12 PM   #4
Nikosis
Member
 
Registered: Dec 2005
Location: In front of the monitor
Distribution: Slackware
Posts: 322

Rep: Reputation: 59
Netconfig for DHCP nad Static IP
 
Old 11-10-2008, 08:36 PM   #5
slackcode
LQ Newbie
 
Registered: Sep 2007
Location: China
Distribution: slackware
Posts: 25

Rep: Reputation: 0
enter: netconfig
 
Old 11-11-2008, 11:02 AM   #6
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: Slackware®
Posts: 13,927
Blog Entries: 45

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,

You could setup a static IP by doing as root from cli;

Code:
~#ifconfig -a                      #get recognized devices
~#ifconfig wlan0 192.168.0.10      #set to a available IP
~#route add default gw 192.168.0.1 #set to your gateway
~#route -n                         #show the route table
~#ifconfig wlan0 up                #should be up already
~#ping 192.168.0.1                 #ping your gateway
~#ping 208.69.32.130               #google.com IP
~#ping google.com                  #test DNS, if fail then
                                   #check /etc/resolv.conf
You should have your '/etc/resolv.conf' setup with your 'ISP DNS' nameservers.

Code:
 sample '/etc/resolv.conf';

search 192.168.1.1           #this would be your local dns/router

nameserver xxx.xxx.xxx.xxx   #ISP DSN 'replace xxx.xxx.xxx.xxx
                             #with IP from your ISP
nameserver 4.2.2.1           #Verizon third level DNS
nameserver 4.2.2.2
nameserver 4.2.2.3
nameserver 4.2.2.4
If this works for you then setup your '/etc/rc.d/rc.inet1.conf' with the information. I used the wlan0 device but the same would be true for the eth0 device.

Last edited by onebuck; 11-19-2008 at 08:10 AM. Reason: to show local dns for OP
 
Old 11-18-2008, 11:08 PM   #7
ninja master
Member
 
Registered: May 2008
Distribution: funtoo/gentoo amd64 xwrt
Posts: 412

Original Poster
Rep: Reputation: 31
yes, i was ifconfiging, but doing a total butcher job at it.

its a 192.168.1.x type network with a network mask of 255.255.255.0 type network. no rocket science to my network =D

ok so my "isp dns" would be my routers dns server? sorry, im a retarded rock star =)
 
Old 11-19-2008, 08:12 AM   #8
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: Slackware®
Posts: 13,927
Blog Entries: 45

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,

I corrected the previous post to reflect your router/modem IP. You should use the DNS supplied from your ISP.
 
Old 11-19-2008, 03:17 PM   #9
adriv
Member
 
Registered: Nov 2005
Location: Diessen, The Netherlands
Distribution: Slackware 15
Posts: 700

Rep: Reputation: 43
While you're at it, you could start surfing via OpenDNS, in your /etc/resolv.conf, you just have to add their nameservers and put them at the top, like this:
Code:
nameserver 208.67.222.222
nameserver 208.67.220.220
 
Old 11-20-2008, 08:15 PM   #10
telemeister
Member
 
Registered: Dec 2007
Location: Brisbane Australia
Distribution: Slackware
Posts: 63

Rep: Reputation: 16
Just another suggestion re using your machine in different locations:

Quote:
i plan on bringing my linux server to a friends to share files, and would like to be able to point directly at the server, without guessing its ip address. thanks!
I use my laptop at several locations with static IP required at each place. I have several versions of all the relevant files and once the machine has booted I move the appropriate files into place using the following simple script.

Code:
#!/bin/bash 
#
#sn:  setup network script
#
#usage: sn <location>
#
echo "Setting up network for : "$1
cp /etc/resolv.conf.$1 /etc/resolv.conf
cp /etc/hosts.$1 /etc/hosts
cp /etc/rc.d/rc.inet1.conf.$1 /etc/rc.d/rc.inet1.conf
/etc/rc.d/rc.inet1 restart
export LOCATION=$1
echo "Location is: " $LOCATION
For example to start work at 'uq' I execute 'sn uq' and 'resolv.conf.uq' is moved into resolv.conf etc etc.

I guess there are smarter ways to work this out automatically, but this manual approach is rock solid.

Steve
 
  


Reply



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
How to set Static IP? maverick_29 Linux - Networking 4 05-25-2007 01:07 AM
How to tell whether IP is set as static or DHCP? loadedmind Fedora 6 11-09-2006 11:08 PM
How to set static IP in Suse 10 leupi SUSE / openSUSE 4 02-19-2006 09:50 PM
FC2 Overriding static if in favor of dhcp system set for static pkraus109 Linux - Networking 8 09-21-2004 11:13 AM
How do i set a static ip in Linux SSBN Linux - Networking 1 04-29-2003 09:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:57 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration