Configure Network Interface Card
Thursday, April 23, 2009
To view the current configuration of the Network Interface Card run : ifconfig
We can use ifconfig command to temporarily changes parameters of the NIC. The syntax is –
ifconfig eth0 ip_address net_mask
Example: ifconfig eth0 192.168.100.1 255.255.255.0
We must keep in mind that the ifconfig command is used to assign the IP address
temporarily. To change the IP address permanently we must use netconfig command.
Using netconfig command we can assign IP address, subnet mask and network related
parameters, like – Gateway address, DNS server address, Host name of this Server,
Domain name etc.
To make the configuration effected, we can restart the computer. However, we can also
restart the network service to apply the settings. To do this we can use the following
command – "service network restart "
We must remind, if we use netconfig it will configure the eth0. To configure eth1 we
should use the following command – " netconfig –d eth1 "
We can bind multiple IP address to a single Ethernet card. To do this we must configure
sub-interface for that particular Network Interface Card. To create sub-interface 0 for
eth0, we should use the following command – "netconfig –d eth0:0 "
To create sub-interface 1 for eth0, we should use command - "netconfig –d eth0:1 ". After setting values
to the sub-interface(s), don’t forget to restart the network service (service network restart).
If we want to configure network card from GUI, we will run "system-config-network " in a Terminal.
Please be noted, the DNS server related configuration goes to /etc/resolv.conf
It is also possible to bind a single or multiple range of IP addresses to a single network
interface card. To do this, go to / etc/sysconfig/network-scripts folder and create a file
named with ifcfg-eth0-range0. I am assuming we are binding a range of IP addresses to eth0.
The contents of this file will be –
IPADDR_START=192.168.0.50
IPADDR_END=192.168.0.100
CLONENUM_START=0
Do not forget to start the network service using service network restart command.
You can bind maximu m 256 IP addresses to a single network interface card.
To bring up/down an interface, say eth0, we use the following commands –
ifup eth0 (To bring up)
ifdown eth0 (To bring down)
To configure eth0 to obtain IP address from dhcp server, we can edit the
/etc/sysconfig/network-scripts/ifcfg-eth0 file as follows –
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
Yes, we can also use the netconfig command in this respect.
To allow a non-privileged user to control network interface card, we can add the following
line in /etc/sysconfig/network-scripts/ifcfg-eth0 file –
USERCTL=yes
Define IP route:
We can set static route per-interface basis. For exammple, if we want to add a route on
eth0, we must use the following file – /etc/sysconfig/network- scripts/route-eth0
The syntax is – ip-address/CIDR via gateway-address
Example - 192.168.1.0/24 via 192.168.100.254
If we use redhat-config-network command, the command uses a different file. It is
/etc/sysconfig/networking/devices/eth0.route. Here, the syntax used is different.
It will be like this –
ADDRESS0=192.168.1.0
NETMASK0=255.255.255.0
GATEWAY0=192.168.100.254
Please note, I define ADDRESS0,NETMASK0 and GATEWAY0. Because, they define the
first static route. For the second static you route, you must use ADDRESS1,NETMASK1
and GATEWAY1 with the same syntax.
OK?
We can use ifconfig command to temporarily changes parameters of the NIC. The syntax is –
ifconfig eth0 ip_address net_mask
Example: ifconfig eth0 192.168.100.1 255.255.255.0
We must keep in mind that the ifconfig command is used to assign the IP address
temporarily. To change the IP address permanently we must use netconfig command.
Using netconfig command we can assign IP address, subnet mask and network related
parameters, like – Gateway address, DNS server address, Host name of this Server,
Domain name etc.
To make the configuration effected, we can restart the computer. However, we can also
restart the network service to apply the settings. To do this we can use the following
command – "service network restart "
We must remind, if we use netconfig it will configure the eth0. To configure eth1 we
should use the following command – " netconfig –d eth1 "
We can bind multiple IP address to a single Ethernet card. To do this we must configure
sub-interface for that particular Network Interface Card. To create sub-interface 0 for
eth0, we should use the following command – "netconfig –d eth0:0 "
To create sub-interface 1 for eth0, we should use command - "netconfig –d eth0:1 ". After setting values
to the sub-interface(s), don’t forget to restart the network service (service network restart).
If we want to configure network card from GUI, we will run "system-config-network " in a Terminal.
Please be noted, the DNS server related configuration goes to /etc/resolv.conf
It is also possible to bind a single or multiple range of IP addresses to a single network
interface card. To do this, go to / etc/sysconfig/network-scripts folder and create a file
named with ifcfg-eth0-range0. I am assuming we are binding a range of IP addresses to eth0.
The contents of this file will be –
IPADDR_START=192.168.0.50
IPADDR_END=192.168.0.100
CLONENUM_START=0
Do not forget to start the network service using service network restart command.
You can bind maximu m 256 IP addresses to a single network interface card.
To bring up/down an interface, say eth0, we use the following commands –
ifup eth0 (To bring up)
ifdown eth0 (To bring down)
To configure eth0 to obtain IP address from dhcp server, we can edit the
/etc/sysconfig/network-scripts/ifcfg-eth0 file as follows –
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
Yes, we can also use the netconfig command in this respect.
To allow a non-privileged user to control network interface card, we can add the following
line in /etc/sysconfig/network-scripts/ifcfg-eth0 file –
USERCTL=yes
Define IP route:
We can set static route per-interface basis. For exammple, if we want to add a route on
eth0, we must use the following file – /etc/sysconfig/network- scripts/route-eth0
The syntax is – ip-address/CIDR via gateway-address
Example - 192.168.1.0/24 via 192.168.100.254
If we use redhat-config-network command, the command uses a different file. It is
/etc/sysconfig/networking/devices/eth0.route. Here, the syntax used is different.
It will be like this –
ADDRESS0=192.168.1.0
NETMASK0=255.255.255.0
GATEWAY0=192.168.100.254
Please note, I define ADDRESS0,NETMASK0 and GATEWAY0. Because, they define the
first static route. For the second static you route, you must use ADDRESS1,NETMASK1
and GATEWAY1 with the same syntax.
OK?
Labels: command, configuration, DNS, IP route, Lan Card, network, Network Interface Card, service, USERCTL
Post a Comment