Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I want to set my Slackware machine to have a static IP assigned from the router, how can I do so?

I assume I have to disable DHCP then edit something to set the requested IP, but I'm not sure where.

(I don't have a GUI)

share|improve this question
Could you be a little bit more clear? are you trying to set a static IP address(assigned by the node) or DHCP Reservation(which is does by the DHCP service)? your question suggests DHCP Reservation, but your "idea" suggest you are setting a static IP. – llua Mar 12 '12 at 3:31
I'm trying to set a static local IP on the Linux machine, like Windows can do. – Zeno Mar 12 '12 at 5:22

This heavily depends on whether or not your router supports it.

You do not need to disable DHCP, the DHCP reservations will need to be provided by your router and the router should have to set up a static standing reservation of the MAC address of the network interface to an IP address.

Of course you don't have to and you can disable DHCP and set up a static IP address altogether on the system by editing /etc/rc.inet1.conf. You can look at the documentation on possible settings here

share|improve this answer
I have a static local IP on a Windows7 machine under the route, I assume it's supported. This is done by doing a setting on the Win7 machine and not the router though. – Zeno Mar 12 '12 at 5:18
@Zeno Yeah, that's one way to do it. The wrong way -- it technically works, but only because there aren't any other systems on your LAN and you're not generating collisions. Telling your router to assign a specific, static IP to the MAC address of your computer is the right way to do it. – Shadur Mar 12 '12 at 9:08
@Shadur If Win7 is a DHCP Server that's the only way to do it and even if it's not it's not wrong if you configure DHCP ranges correctly. – Karlson Mar 12 '12 at 12:32
@Zeno Take a look at the last paragraph of my answer and the link. – Karlson Mar 12 '12 at 12:35
@Karlson What I think he means is that he's got one router and one actual desktop comp that dualboots windows and linux, and in windows he just assigns a static IP. – Shadur Mar 12 '12 at 13:06
  • To disable Disable DHCP on my openSUSE machine I use the following script. The main thing to note is that, unlike "service SERVICENAME stop" command, "systemctl disable SERVICENAME.service" persists after boot (where SERVICENAME is the name of the service you want to disable).

    systemctl disable wickedd-dhcp4.service

wickedd-dhcp4 was the name of service handling DHCP client configuration on my system. For disabling IPv6 DHCP as well use the following.

systemctl disable wickedd-dhcp6.service

  • Once you have the DHCP disabled, you can assign static IP by either of the following ways.

    1. Editing "/etc/network/interfaces" file one sample configuration to assign static IP to eth0 interface could be the following.

    allow-hotplug eth0 iface eth0 inet static address netmask network broadcast gateway

    1. using ifconfig (Ubuntu)

    ifconfig eth0 netmask

    1. Using ip command (openSUSE)

    ip addr add brd + dev eth0

Needless to say that there are hundreds of other commandling utilities available.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.