Jump to content

alright i just set up an old pc with ubuntu server, now to make it easier to connect to it via my local network i want to give it a static ip, an ip that is always going to use when connected to my local network, now i have no idea if i have to do this via the router or directly with that pc, right now i have ssh connection to it with the dhcp ip given by the router but since that ip is going to change every time it has to be turned off or rebooted.

 

I want a way i know for sure its going to connect whenever is ssh or in the future different stuff (like a torrent server) via my local network.

this is one of the greatest thing that has happened to me recently, and it happened on this forum, those involved have my eternal gratitude http://linustechtips.com/main/topic/198850-update-alex-got-his-moto-g2-lets-get-a-moto-g-for-alexgoeshigh-unofficial/ :')

i use to have the second best link in the world here, but it died ;_; its a 404 now but it will always be here

 

Link to comment
https://linustechtips.com/topic/774092-local-network-static-ip-ubuntu-server/
Share on other sites

Link to post
Share on other sites

Typically changing the IP address is done through the server directly, rather than doing it via remote connection (at least, from my experience). If the server has a command line for changing some base settings, you'll likely do it through there. 

 

Also, DHCP doesn't necessarily change the IP address each time the server is rebooted. My FreeNAS server uses DHCP with 192.168.1.224 and I haven't bothered to set it to static because it's never changed on me when I shut down or reboot the server. Unless your network is very active, with new devices coming and going all the time, DHCP addresses shouldn't need to be reassigned that often. 

 

That said, It's a good idea to free up a space of IP addresses by setting the router's DHCP pool to something like 192.168.1.21 - 192.168.1.220. That way you get 192.168.1.2 (assuming router is on 1.1) to 192.168.1.20 and 192.168.1.21 to 192.168.1.254 as static address space. Would leave 192.168.1.254 free though as it's often a default address for new devices. 

Link to post
Share on other sites

Like @manikyath said, there shoud be an option in your router's DHCP server to lease an IP address based on your server's MAC address. Look around in your router administration panel, there should be a menu option for it somewhere.

Otherwise you could always configure your server with a static IP that has the same subnet as the one used by your router. However doing so with a DHCP server on the network might eventually cause an address collision, so such a configuration might not always be a good option.

 

Link to post
Share on other sites

When it comes to ubuntu server; if you can get a decent result from google then it is much faster to get to what you want by searching the debian wiki.

use ifconfig to get name of your NIC

Modify the /etc/network/interfaces file to give it a static IP.

https://wiki.debian.org/NetworkConfiguration#Configuring_the_interface_manually

 

             ☼

ψ ︿_____︿_ψ_   

Link to post
Share on other sites

6 hours ago, Night_ said:

 

Otherwise you could always configure your server with a static IP that has the same subnet as the one used by your router. However doing so with a DHCP server on the network might eventually cause an address collision, so such a configuration might not always be a good option.

you'd have to choose one outside dhcp range (most routers' stock settings only lease ~100 IP addresses out of 253 available)

Link to post
Share on other sites

4 hours ago, Night_ said:

@manikyath

Some can issue address outside the range even if configured not to. Regardless though, system-wise it's still a better idea to let the DCHP handle this kind of thing if it already exists on the same network.

if dhcp is configured to only give a specific range, and it gives IPs outside of that range, you should throw your router in the garbage.

Link to post
Share on other sites

15 minutes ago, Night_ said:

@manikyath

And waste what otherwise could be a well-manifactured piece of hardware? Please, that's part of the reason why there's alternative open-source Linux or BSD based firmwares out there.

if a DHCP server gets allocated a range, it should use that, and only that range. i dont even wanna know what other idiotic crap they did beyond that.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×