Change StaffCop Server IP

Usually, IP addresses are assigned with dhcp in LAN.

This is quite handy, but it has a drawback, which is expressed in the fact that after rebooting the IP address of the computer may change.

For most workstations this is not critical, but for local servers it is very important to have the same IP for a long time.

This can be done by stating a static IP address for the server.

Automatic change

wget dist.staffcop.ru/utils/dinamic-to-static-ip.sh
sudo bash dinamic-to-static-ip.sh

The current dynamic IP address will be assigned to your machine as static. Which means that the automatic way keeps the address unchanged.

If you want to immediately assign an address to your server, enter this address separated by a space after the name of the script, for example:

sudo bash dinamic-to-static-ip.sh 192.168.1.132

Manual change

This is done in a usual way: edit the configuration file and restart the service.

You must specify the following:

  • Interface name of eth0 (may be different, use ifconfig)
  • Subnet mask
  • Computer IP
  • Default gateway

open the file in your favorite editor:

sudo nano /etc/network/interfaces

mark out two lines (put a # sign in front of them)

#auto eth0
#iface eth0 inet dhcp

It’s better to mark out lines, not delete them, because if you are reading this guide, then configuring the network in Linux is new to you, and you can forget exactly what you need to enter if you suddenly need to return to dhcp receiving the address.

and write the following:

auto eth0
iface eth0 inet static
address 192.168.1.125
netmask 255.255.255.0
gateway 192.168.201.254
dns-nameservers 8.8.8.8 192.168.201.254
  1. Our interface turns on automatically when starting
  2. The type of IP address and the method of assignment, which means static assignment
  3. IP address
  4. Subnet mask.
  5. The address of your gateway, that is, a router or Internet access point.
  6. Then, 2 DNS servers are listed, one of which is a Google name server, and the second is located on the local network at 192.168.201.254. Your local dns server can be checked with the network system administrator or peeped in the settings of the network card of the working machine with windows.

For the changes to take effect, restart the interface.

sudo /etc/init.d/networking restart

Or restart the entire virtual or real machine

sudo reboot