Change IP, Netmask, Default GW on linux


 
Thread Tools Search this Thread
Operating Systems Linux Change IP, Netmask, Default GW on linux
# 1  
Old 05-10-2004
Change IP, Netmask, Default GW on linux

How can I permenantly change the IP, netmask and default GW
for Linux server on Apatchi.
# 2  
Old 05-10-2004
[root@test root]# vi /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1   localhost.localdomain   localhost
192.168.1.1  linux001
192.168.1.2  linux002
192.168.1.3  linux003
.........
.........
192.168.1.255 linux25


[root@test root]# vi /etc/resolv.conf
nameserver xxx.xx.x.x
nameserver xx.xx.xx.xx



[root@test root]# vi /etc/sysconfig/network
GATEWAY=
GATEWAYDEV=eth0

Last edited by HOUSCOUS; 05-10-2004 at 08:49 PM..
# 3  
Old 05-11-2004
Or you can use command:

To set interface, ip number, broadcast, netmask

#ifconfig $iface $ip_number broadcast $broadcast_number netmask $netmask

To set default gw:

#route add -net default gw $gateway netmask 0.0.0.0 1 $iface

Good Luck
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Linux

How do we change the default font on Linux system?

I have two hosts i.e host1 & host2. host1 has the desired font details of which are below: uname -a Linux host1 3.10.0-693.21.1.el7.x86_64 #1 SMP Wed Mar 7 19:03:37 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux $ fc-match StRydeRegular.ttf: "St Ryde" "Regular" I need the same default font... (27 Replies)
Discussion started by: mohtashims
27 Replies

2. Shell Programming and Scripting

How to change ip addressing format from CIDR notation to netmask and vice versa?

Hi all, I would appreciate if someone could share how to convert CIDR notation to netmask and vice versa. The value below is just an example. it could be different numbers/ip addresses. Initial Output, let say file1.txt Final Output, let say file2.txt (3 Replies)
Discussion started by: type8code0
3 Replies

3. Solaris

Netmask settings in Solaris 11

I have net0 as my primary network interface in Solaris 11. # ifconfig net0 net0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2 inet 10.53.77.154 netmask ffffff00 broadcast 10.53.77.255 ether 0:10:e0:3a:c4:d8 Its netmask should be fffffc00, but whenever I... (8 Replies)
Discussion started by: solaris_1977
8 Replies

4. Shell Programming and Scripting

how to calculate netwrk from IP address and netmask using Bitwise AND in shell script

Hi, I am having two variables IP="10.150.12.1" netmask="255.255.255.0" To get network number, I know that a bitwise & will help. networkno=IP & netmask My code is #!/usr/bin/ksh ip="10.150.12.1" netmask="255.255.255.0" networkno="$ip" & "$netmask" echo $networkno I am... (7 Replies)
Discussion started by: chaitanyapn
7 Replies

5. Shell Programming and Scripting

how to change default shell in linux?

currently the default shell in my linux enviornemnt is ksh. how to change the default shell to bash? thanks! (8 Replies)
Discussion started by: princelinux
8 Replies

6. Solaris

ifconfig - making netmask & broadcast address permanent?

hi, I am trying to configure one of my interfaces, but after reboot - i lose the changes to the netmask & broadcast address. I have added an entry in /etc/netmasks, but it doesnt pick up the new settings. any ideas - much appreciated. before reboot: eri0:... (3 Replies)
Discussion started by: badoshi
3 Replies

7. IP Networking

Netmask change online

Hi, I have a system which has been setup with a netmask of 255.255.252.0 . The customer says this netmask is wrong as is causing them some problems. They want me to change it too 255.255.254.0 So what would the command be for my bge0 port. Can I do this whilst its running the software ?... (1 Reply)
Discussion started by: Maillot Jaune
1 Replies

8. UNIX for Advanced & Expert Users

nfs exports and netmask option

Setting up nfs on a redhat ES 4 gives me following issue that i can't explain. My nfs was working perfect whith following /etc/exports on the server /home/test/nfstest 198.9.200.227(rw,sync,no_root_squash) But after a powerloss and restart of the server it only works with the... (0 Replies)
Discussion started by: progressdll
0 Replies

9. Shell Programming and Scripting

script for netmask check

I want develop a script which should also check validity of netmask. e.g. /etc/netmasks 10.15.20.30 255.255.255.224 How can I check which IP adresses are valid for this netmask? I think the best is use logical operations. 224 is 1 1 1 0 0 0 0 0 so is valid from 10.15.20.31... (2 Replies)
Discussion started by: rhacodactylus
2 Replies

10. IP Networking

Netmask

Hi, On our new Solaris machine I have set up a network card with an IP of 10.44.12.102 , netmask of 255.255.252.0 and broadcast 19.44.15.255. These are to match current configuration on the other servers (running an older Solaris). However , after the machine is rebooted the ifconfig -a displays... (2 Replies)
Discussion started by: markdr011
2 Replies
Login or Register to Ask a Question