• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

IP Commands to Configure Network Interfaces

206

IP Command to Configure Network Interfaces

In this tutorial we will discuss about Configuring Static IP Address Internet Protocol (IPv4). In order to assign Static IP Address, you need to update or edit network configuration file. Using IP command, set IP address without update or edit network configuration file.

Assign IP Address to Specific Interface

Run the following commands to assign IP address to a specific interface using ip command.

[root@linuxhelp Desktop]# ip addr add 192.168.5.82 dev eth0

All the settings will be lost when you reboot your system.

Command to check ip address

The following ip commands provide you with more information of your network interfaces like MAC Address information and IP Address.
You can use any of these two command as shown below.

[root@linuxhelp Desktop]# ip addr show

or

[root@linuxhelp Desktop]# ip a 
1: lo: < LOOPBACK,UP,LOWER_UP>  mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: < BROADCAST,MULTICAST,UP,LOWER_UP>  mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:dd:23:8c brd ff:ff:ff:ff:ff:ff
inet 192.168.5.82/24 brd 192.168.5.255 scope global eth0
inet6 fe80::20c:29ff:fedd:238c/64 scope link
valid_lft forever preferred_lft forever
3: virbr0: < BROADCAST,MULTICAST,UP,LOWER_UP>  mtu 1500 qdisc noqueue state UNKNOWN
link/ether 52:54:00:86:7c:3d brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
4: virbr0-nic: < BROADCAST,MULTICAST>  mtu 1500 qdisc noop state DOWN qlen 500
link/ether 52:54:00:86:7c:3d brd ff:ff:ff:ff:ff:ff

Command to remove the IP address

The following ip command will remove an assigned IP address from the given interface.

[root@linuxhelp Desktop]# ip addr del 192.168.5.82 dev eth0

After removed ip address you can verify the status by below command.

[root@linuxhelp songs]# ip a
eth0: < BROADCAST,MULTICAST>  mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether 00:0c:29:dd:23:8c brd ff:ff:ff:ff:ff:ff

Command to Enable Network Interface

The flag, up with the interface name eth0 enables a network interface.

[root@linuxhelp Desktop]# ip link set eth0 up

After enabled network interface you can verify the status by below command.

[root@linuxhelp Desktop]# ip a
eth0: < BROADCAST,MULTICAST,UP,LOWER_UP>  mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:10:e1:fd brd ff:ff:ff:ff:ff:ff
inet 192.168.5.82/24 scope global eth0
inet6 fe80::20c:29ff:fe10:e1fd/64 scope link
valid_lft forever preferred_lft forever

Command to Disable Network Interface

The flag, down with interface name eth1 disables a network interface.

[root@linuxhelp Desktop]# ip link set eth0 down

After disabled network interface you can verify the status by below command.

[root@linuxhelp Desktop]# ip a
eth0: < BROADCAST,MULTICAST>  mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether 00:0c:29:dd:23:8c brd ff:ff:ff:ff:ff:ff
inet 192.168.5.82/24 scope global eth0

Command to Check the Route Table information

The following ip command checks the information in routing table

[root@linuxhelp Desktop]# ip route show
192.168.5.0/24 dev eth0 proto kernel scope link src 192.168.5.82 metric 1
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1
default via 192.168.5.1 dev eth0 proto static

Command to Adding Static Route

Generally static routes are added to pass traffic from the best way to reach the proper destination.

[root@linuxhelp Desktop]# ip route add 192.168.5.90 via 192.168.5.1 dev eth0

Command to Removing Static Route

Type the following ip command to remove the assigned static route.

[root@linuxhelp Desktop]# ip route del 192.168.5.90

Adding a permanent Static Routes

If you would like to add permanent Static route, then edit file /etc/sysconfig/network-scripts/route-eth0 and add the following command lines, save and exit.

[root@linuxhelp Desktop]# ip route del 192.168.5.90

Now restart your network services after assigned static routes in configuration file.

[root@linuxhelp Desktop]# service network restart

Adding a permanent IP address

If you want to add permanent ip address you should configure at the following path /etc/sysconfig/network-scripts/ifcfs-eth0, now your ip address assigned permanently.

[root@linuxhelp Desktop]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:0C:29:DD:23:8C
TYPE=Ethernet
UUID=6576f85b-e6f5-42aa-bed3-fb207ab86ba1
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.160.5.82
NETMASK=255.255.255.0
GATEWAY=192.160.5.1
DNS1=8.8.8.8

Now restart your network services after assigned IP in configuration file.

[root@linuxhelp Desktop]# service network restart

Tags:
owen
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

How to Assign an IP Address to Specific Interface in Linux?

A

You can use the command to Assign an IP Address to Specific Interface in Linux. For Syntax: "ip addr add 192.168.50.5 dev eth1"

Q

How to Check an IP Address for a certain interface?

A

You can use the command to Check an IP Address for a certain interface. For Syntax: " ip addr show"

Q

How to Remove an IP Address for any certain interface in Linux?

A

You can use the following command to Remove an IP Address for any certain interface in Linux. For Syntax: " IP address del 192.168.50.5/24 dev eth1".

Q

How to Enable Network Interface in Linux?

A

You can use the following syntax to Enable Network Interface in Linux. For Ex: "ip link set eth1 up".

Q

How do I Check Route Table using the "ip" command in Linux?

A

You can use the following command to Check Route Table using the "ip" command in Linux. For Syntax: " ip route show".

Related Tutorials in IP Commands to Configure Network Interfaces

Related Tutorials in IP Commands to Configure Network Interfaces

IP Commands to Configure Network Interfaces
IP Commands to Configure Network Interfaces
Apr 8, 2016
How to create Multiple IP Address to Single Network interface
How to create Multiple IP Address to Single Network interface
Jul 21, 2016
Difference between ip and ifconfig command
Difference between ip and ifconfig command
Jun 1, 2016

Related Forums in IP Commands to Configure Network Interfaces

Related Forums in IP Commands to Configure Network Interfaces

ip command
oliver class=
How to view the outside IP from command-line in linux
May 15, 2017
Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help David Lopez Guillen ?
Ayuda urgente instale SSL para servidor Opensuse y ahora no funciona tengo servicio web

hola segui este tutorial para tener un certificado ssl y ahora no se ve mi app en la red, espero alguien pueda ayudarme, tengo M9oodle en3.5 en un servidor open suse y ahora no funciona por favor ayuda.

https://www.linuxhelp.com/how-to-create-ssl-certificate-in-opensuse

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.