LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Static IP address (http://www.linuxquestions.org/questions/slackware-14/static-ip-address-387347/)

mikz 11-28-2005 04:25 PM

Static IP address
 
I have a slackware 10 which acts a webserver. The webserver is on my LAN and recieves its IP (192.168.0.4) via the DHCP from my router which has an IP-pool of 192.168.0.1 - 99.
How do I go about giving my webserver a 'static' ip which would still be visible to the rest of the LAN.?

Is it enough to change the appropiate files in /etc/rc.d/?

Alien Bob 11-28-2005 04:35 PM

This would do (put it in /etc/rc.d/rc.inet1.conf):
Code:

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

....

# Default gateway IP address:
GATEWAY="192.168.0.XXX"

Where the XXX is the IP of your router/gateway.
If your server uses eth1 instead, change the [0] into [1]. Don't forget to remove the existing DHCP related lines for your network interface (the USE_DHCP[0]="yes" specifically)

Eric

mikz 11-28-2005 04:43 PM

Would I also need to edit /etc/resolv.conf?

raska 11-28-2005 05:17 PM

Quote:

Originally posted by mikz
Would I also need to edit /etc/resolv.conf?
don't think so, that one is for your DNS servers ;)

urka58 11-28-2005 05:30 PM

It is also possible you assign a static IP address by DHCP adding some lines to your /etc/dhcp/dhcp.conf like


host myhost {
hardware ethernet xx:xx:xx:xx:xx:xx;
fixed-address 192.168.0.100;
}

replace xx's with your actual HW address
edit your /etc/hosts file adding something like
192.168.0.100 myhost.mynet.org myhost
Ciao


All times are GMT -5. The time now is 07:23 PM.