redhat_-_network:set_ip:set_ip
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
redhat_-_network:set_ip:set_ip [2017/04/04 08:35] – created peter | redhat_-_network:set_ip:set_ip [2021/01/08 11:56] (current) – removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Redhat - Network - Set IP ====== | ||
- | |||
- | ===== Set Temporarily IP ===== | ||
- | |||
- | 1. Set ip and netmask. | ||
- | |||
- | <code bash> | ||
- | ifconfig eth0 10.20.1.10 netmask 255.255.255.0 up | ||
- | </ | ||
- | |||
- | where: | ||
- | |||
- | * **eth0** is the name of the interface. | ||
- | * **255.255.255.0** is the netmask. | ||
- | * **up** is to activate the interface | ||
- | |||
- | |||
- | 2. Set default gateway. | ||
- | |||
- | <code bash> | ||
- | route add default gw 10.20.1.1 | ||
- | </ | ||
- | |||
- | where: | ||
- | |||
- | * **10.20.1.1** is your gateway ip. | ||
- | |||
- | |||
- | 3. Check the configuration. | ||
- | |||
- | Check the gateway: | ||
- | |||
- | <code bash> | ||
- | route -n | ||
- | </ | ||
- | |||
- | Check the ip address: | ||
- | |||
- | <code bash> | ||
- | ifconfig | ||
- | </ | ||
- | |||
- | |||
- | ===== Set Permanent IP ===== | ||
- | |||
- | 1. Go to folder / | ||
- | |||
- | <code bash> | ||
- | cd / | ||
- | </ | ||
- | |||
- | |||
- | 2. Backup your existing configuration. | ||
- | |||
- | <code bash> | ||
- | cp ifcfg-eth0 ifcfg-eth0.bak | ||
- | </ | ||
- | |||
- | |||
- | 3. Edit ifcfg-eth0 with your favorite editor | ||
- | |||
- | <code bash> | ||
- | vi ifcfg-eth0 | ||
- | </ | ||
- | |||
- | |||
- | 4. Add below line to the ifcfg-eth0 file to setup your ip | ||
- | |||
- | <file bash ifcfg-eth0> | ||
- | BOOTPROTO=static | ||
- | DEVICE=eth0 | ||
- | IPADDR=10.20.1.20 | ||
- | NETMASK=255.255.255.0 | ||
- | NETWORK=10.20.1.0 | ||
- | ONBOOT=yes | ||
- | TYPE=Ethernet | ||
- | </ | ||
- | |||
- | |||
- | 5. Save the file. | ||
- | |||
- | |||
- | 6. Add below line to / | ||
- | |||
- | < | ||
- | GATEWAY=10.20.1.1 | ||
- | </ | ||
- | |||
- | |||
- | 7. Save and restart network | ||
- | |||
- | <code bash> | ||
- | / | ||
- | </ | ||
- | |||
- | |||
- | 8. Check your newly created ip. | ||
- | |||
- | Check the gateway: | ||
- | |||
- | <code bash> | ||
- | route -n | ||
- | </ | ||
- | |||
- | Check the ip address: | ||
- | |||
- | <code bash> | ||
- | ifconfig | ||
- | </ | ||
redhat_-_network/set_ip/set_ip.1491294917.txt.gz · Last modified: 2020/07/15 09:30 (external edit)