How to change ip address on Linux server

Hi Experts,

  I have a linux server with a static ip address of 10.10.2.36. I would like to change to a different address. I'm at the following prompt, please note I have no experience with Linux, I just want to change the ip address.

[root@nglinux04]#

frankbustosAsked:
Who is Participating?
 
furettoCommented:
If you would like linux to reflect your windows configuration, use the following in /etc/sysconfig/network-scripts/ifcfg-eth0

GATEWAY=192.168.88.1
BOOTPROTO=none
TYPE=Ethernet
DEVICE=eth0
NETMASK=255.255.254.0
BROADCAST=192.168.89.255
IPADDR=192.168.89.155
NETWORK=192.168.88.0
DNS1=192.168.88.2
ONBOOT=yes

and this in /etc/sysconfig/network
NETWORKING=yes
GATEWAY=192.168.88.1
HOSTNAME=yourhostname
0
 
mrcannonCommented:
Each distro has it's own GUI methods however...

this command will set ip address of ethernet adapter eth0 to 192.168.1.5
# ifconfig eth0 192.168.1.5 netmask 255.255.255.0 up
# ifconfig eth0

To make permanent changes to IP address you need to edit configuration file according to your Linux distribution.

0
 
frankbustosAuthor Commented:

ok, this is my windows ipconfig/all
IP Address. . . . . . . . . . . . : 192.168.89.155
Subnet Mask . . . . . . . . . . . : 255.255.254.0
Default Gateway . . . . . . . . . : 192.168.88.1
DHCP Server . . . . . . . . . . . : 192.168.88.12
DNS Servers . . . . . . . . . . . : 192.168.88.2
                                    172.21.0.12
                                    172.21.1.10
Primary WINS Server . . . . . . . : 10.2.102.4
Secondary WINS Server . . . . . . : 10.2.102.5


I  typed in this command #root: vi /etc/sysconfig/network-scripts/ifcfg-eth0 and I'm now editing but need to know the broadcast address and network address?
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
aleghartCommented:
Network address is x.x.x.0
Broadcast address is x.x.x.255

All the numbers from x.x.x.1 - 254 are for your use on the LAN.
0
 
expert1010Commented:
The prefered method is not ifconfig now days. It's "ip".

ip addr change 192.168.89.155/23 dev eth0

check with "ip addr" to see that it is correct.

For permanent changes you should do as suggested in /etc/.....

To get the broadcast address and such install sipcalc and do this.

sipcalc 192.168.89.155 255.255.254.0
or
sipcalc 192.168.89.155/23

You'll get this
-[ipv4 : 192.168.89.155/23] - 0

[CIDR]
Host address            - 192.168.89.155
Host address (decimal)  - 3232258459
Host address (hex)      - C0A8599B
Network address         - 192.168.88.0
Network mask            - 255.255.254.0
Network mask (bits)     - 23
Network mask (hex)      - FFFFFE00
Broadcast address       - 192.168.89.255
Cisco wildcard          - 0.0.1.255
Addresses in network    - 512
Network range           - 192.168.88.0 - 192.168.89.255
Usable range            - 192.168.88.1 - 192.168.89.254


If you're on a debian-based thing do this:
apt-get install sipcalc

suse:
zypper in sipcalc

on red had/centos/fedora you already have ipcalc
do this and you'll get almost the same result
ipcalc 192.168.0.1/23
0
 
joolsCommented:
you dont have to enter the broadcast and network addresses, the system can work them out for you.
0
 
frankbustosAuthor Commented:
thanks for your expert help!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.