LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Wireless Networking (https://www.linuxquestions.org/questions/linux-wireless-networking-41/)
-   -   Static Network settings (https://www.linuxquestions.org/questions/linux-wireless-networking-41/static-network-settings-383558/)

scott4957 11-15-2005 11:14 PM

Static Network settings
 
Forgive the newbie questions, but i have to compare it to windows.

How do i set up a static ip address and other settings that go along with it on my wireless adapter in the linux shell?

I am going to enable MAC filtering and static ip's on my wireless router, but i do not know how to set up my Mandrake box for the static settings like i did on my windows boxes. I suppose i need to set the ipaddress, subnet mask, the default gateway, and the dns server "not all are necessary for my network" I would like to do it all at the shell, i was told that was the best way to learn it. Then possibly i can write a shell script that would load all these settings rather then have them saved in the config file for my adapter because I use it at work as well. Thanks in advance for any help.

RS

SaxyWeed 11-16-2005 12:10 AM

The commands you are looking for are ifconfig and route (see man pages) for setting the ip address and the default route. But there is an easier way to do this. Distros already have all teh scripts in place for this. You just need to edit the configuration files:

/etc/sysconfig/networking/devices/ifcfg-wlan0 - (where wlan0 is your interface) - on Fedora this has ip and gateway configuration. I'm not sure about mandrake

/etc/resolv.conf - this holds the DNS server info.

-Matt

gd2shoe 11-16-2005 09:58 AM

I don't have wireless, and haven't played with it on linux. That said, you should also investigate "iwconfig".

Example lines:
# Show ipaddress, netmask, etc
ifconfig
# Show gateway, other routes
route
# activate the first ethernet card(eth0) and assign it an address
# (note that the syntax is not too strict with ifconfig. Things can be placed in different orders)
ifconfig eth0 up 192.168.0.2
# set a default gateway (after changing your ip address)
route add default gw 192.168.0.1
# line in resolv.conf to set a nameserver
# (good idea to do this first. You're box may not see a chage until you take the card down and back up again)
# Note that many, but not all, routers will handle dns for you.
nameserver 192.168.0.1

Again, it usually is best to set these in the config files. (I don't remeber which one off the top of my head)


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