LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
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 07-12-2009, 01:52 PM   #1
Biggen
Member
 
Registered: Sep 2004
Location: Panama City Beach FL
Distribution: Slackware 12.2
Posts: 199

Rep: Reputation: 31
Changing Static IP Addresses


I guess I have confused myself to the point where my eyes are getting blurry and now I seek help.

Here is what I want to do:

I want to connect to my home wireless network. My network is not running any kind of encryption right now to make things easier. I DON'T have DHCP turned on, on my wireless router. I also DON'T want to use the netconfig script with Slack. I want to be able to change, by hand, my IP address, Netmask, Gateway, & DNS Server. I'd like to be able to use:

IP - 192.168.1.10
Netmask - 255.255.255.0
Gateway - 192.168.1.1
DNS - 192.168.1.1

I was thinking all the commands I need were taken care of through "ifconfig" but I must have the syntax wrong as I can't seem to get it right.

So, I know I do a:
Code:
iwconfig ath1 essid "my network"
That successfully authenticates me. I can see packets on the network (via Wireshark).

From here, I have seen several different "ifconfig" command line options. Surely, there must be a fairly "easy" way to get this in

I realize, that none of this will stick through a re-boot, and that is fine. I just want to be able to change the info "on-the-fly"...
 
Old 07-12-2009, 02:27 PM   #2
escaflown
Member
 
Registered: May 2009
Location: Canada
Distribution: Slackware
Posts: 237

Rep: Reputation: 30
I think you should find everything you need on Bob's page about network configuration in Slackware http://alien.slackbook.org/dokuwiki/...ckware:network
 
Old 07-12-2009, 02:36 PM   #3
Karu
Member
 
Registered: Jul 2007
Location: Estonia
Distribution: Slackware
Posts: 53

Rep: Reputation: 16
You will probably install wicd from /extra. Then you can handle both dhcp and static IP address, both wired and wireless connection.
 
Old 07-12-2009, 02:52 PM   #4
Biggen
Member
 
Registered: Sep 2004
Location: Panama City Beach FL
Distribution: Slackware 12.2
Posts: 199

Original Poster
Rep: Reputation: 31
Thanks for the response guys!

I have looked at that .conf file, but it seems strange that I would have to edit out a .conf file and then restart inet1 everytime I needed to change the IP', Gateway's, etc.. on the machine. I would have thought there would be some type of command line switch to do that with.

I'll have a look at wicd!
 
Old 07-12-2009, 03:30 PM   #5
bgeddy
Senior Member
 
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Rep: Reputation: 227Reputation: 227Reputation: 227
You can always use CLI tools if you wish - however the /etc/rc.d/rc.inet1.conf file is the standard way of configuring stuff. As root run :
Quote:
ifconfig ath1 192.168.1.10 netmask 255.255.255.0
route add default gw 192.168.1.1 ath1
echo "nameserver 192.168.1.1" > /etc/resolv.conf
to do this from the CLI.
 
Old 07-12-2009, 03:32 PM   #6
Erik_FL
Member
 
Registered: Sep 2005
Location: Boynton Beach, FL
Distribution: Slackware
Posts: 801

Rep: Reputation: 247Reputation: 247Reputation: 247
To make the changes temporarily do this.

dhcpcd -k -o eth0
ifconfig eth0 up
ifconfig eth0 192.168.1.10
ifconfig eth0 netmask 255.255.255.0
route add default gw 192.168.1.1

The only way to change the name server is to edit this file.

/etc/resolv.conf

Contents of file:

Code:
nameserver 192.168.1.1
If you use "nscd" to cache name server information then you have to restart "nscd".

nscd -K
nscd

Be careful when entering the command "dhcpcd" because there are similar commands such as "dhcpd". There are two "c" characters in the correct command name.

If you want to set (or reset) the interface according to the normal (boot time) configuration files then you can usually restart the network interface like this.

/etc/rc.d/rc.inet1 eth0_restart

That will undo any temporary manual changes that you have made. If you have edited the configuration files you can also use that to reload the configuration files without rebooting.

I hope that answers your question. Your distro may be slightly different. As always the devil is in the details.
 
Old 07-12-2009, 04:45 PM   #7
Biggen
Member
 
Registered: Sep 2004
Location: Panama City Beach FL
Distribution: Slackware 12.2
Posts: 199

Original Poster
Rep: Reputation: 31
This was exactly what I was looking for! I'll give it a shot now...

Thanks Erik_FL & bgeddy!
 
Old 07-12-2009, 05:57 PM   #8
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 11,381
Blog Entries: 3

Rep: Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478
Hi,

You can always setup a static IP for the desired device as long as that device has the proper drivers. You could setup a static IP first, do 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     

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
Just remember that you can setup the '/etc/rc.d/rc.inet1.conf' to reflect any settings of your needs or desires. 'wicd' is a very useful tool that would allow you too do as you wish without manual intervention. You can always restart the 'inet' with '/etc/rc.d/rc.inet1.conf restart'. Another useful tool would be the daemon 'ifplugd' if you must connect/disconnect the wired.

'Configuring your network in Slackware' is Alien_Bob's excellent article on the way network cards are configured in Slackware.

The above links and others are available from 'Slackware-Links'. More than just SlackwareŽ links!
 
Old 07-13-2009, 08:19 AM   #9
Biggen
Member
 
Registered: Sep 2004
Location: Panama City Beach FL
Distribution: Slackware 12.2
Posts: 199

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by onebuck View Post
Hi,

You can always setup a static IP for the desired device as long as that device has the proper drivers. You could setup a static IP first, do 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     

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
Just remember that you can setup the '/etc/rc.d/rc.inet1.conf' to reflect any settings of your needs or desires. 'wicd' is a very useful tool that would allow you too do as you wish without manual intervention. You can always restart the 'inet' with '/etc/rc.d/rc.inet1.conf restart'. Another useful tool would be the daemon 'ifplugd' if you must connect/disconnect the wired.

'Configuring your network in Slackware' is Alien_Bob's excellent article on the way network cards are configured in Slackware.

The above links and others are available from 'Slackware-Links'. More than just SlackwareŽ links!
As always, you guys are as helpful as ever. I do a lot of troubleshooting in field and am moving away from Windows and concentrating on using Slack more and more on my laptop. Hence, the reason, I was looking for a way to (fairly) easily and painlessly do the above.

It's just a few more commands lines to remember, but what is 4 or 5 more when I already have a few hundred in my head...

;-)

Thanks!
 
Old 07-13-2009, 10:59 AM   #10
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 11,381
Blog Entries: 3

Rep: Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478
Hi,

I try to keep things in my toolbox.

That way the old gray won't fail me. That is unless I forget the toolbox. I keep a lot on CD/DVD or even Flash. It all depends on the job at hand.
 
Old 07-13-2009, 11:02 AM   #11
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: Tupelo, MS
Distribution: Gentoo
Posts: 6,926

Rep: Reputation: 124Reputation: 124
Just a suggestion ...

Well, you might not need it, as you sound like your
bulb is quite a bit brighter than mine.

There is a file on every box on this LAN, which is
constantly added to and rsync'ed around, whose name
is good_commands. It is presently 28K and 938 lines
of information that sometimes 'saves my bacon'.
 
Old 07-13-2009, 11:40 AM   #12
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 11,381
Blog Entries: 3

Rep: Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478
Hi,

My lifesaver when at the console is 'man'. 'man' is your friend 'man'.

I really still 'man' a lot to just insure my gray is not faded.

Heck, 'history' still saves my a$$. Puns intended!
 
Old 07-13-2009, 11:48 AM   #13
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware & Slackware64 14.1
Posts: 7,076
Blog Entries: 52

Rep: Reputation: Disabled
Quote:
Originally Posted by onebuck View Post
'man' is your friend 'man'.
Or WoMan, man.
http://www.emacswiki.org/emacs/WoMan#WomanMode
 
Old 07-13-2009, 11:50 AM   #14
Biggen
Member
 
Registered: Sep 2004
Location: Panama City Beach FL
Distribution: Slackware 12.2
Posts: 199

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by Bruce Hill View Post
Just a suggestion ...

Well, you might not need it, as you sound like your
bulb is quite a bit brighter than mine.

There is a file on every box on this LAN, which is
constantly added to and rsync'ed around, whose name
is good_commands. It is presently 28K and 938 lines
of information that sometimes 'saves my bacon'.
My "important_stuff" file on my server is just under 8K. I feel like a lightweight now!!

 
Old 07-13-2009, 02:31 PM   #15
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 11,381
Blog Entries: 3

Rep: Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478
Hi,
Quote:
Originally Posted by brianL View Post
Real men use 'man'!
 
  


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
DHCP with static and dynamic addresses marozsas Linux - Networking 13 09-19-2007 05:11 PM
Howto Assign Multiple Static Public IP Addresses under SBC's PPPoE Static Ip system o trekgraham Linux - Networking 8 04-17-2007 11:51 AM
From DHCP back to static addresses energiza Linux - Networking 2 08-10-2006 12:57 PM
Static IP addresses BCarey Linux - Networking 5 05-06-2006 05:30 PM
Multiple static IP addresses fr0zen Linux From Scratch 5 11-23-2005 07:47 PM


All times are GMT -5. The time now is 08:53 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