Step 1. Check the network interfaces avilable.
Command : "lspci | grep Ethernet"
Sample Output:
00:04.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 20)
00:05.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 20)
Step 2: Check if the linux kernel have identified and loaded the devices.
Command: "ifconfig -a"
Sample Output:
eth0 Link encap:Ethernet HWaddr 77:03:8e:80:31:f5
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8585824 errors:0 dropped:86 overruns:0 frame:0
TX packets:2926444 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1499815123 (1.3 GiB) TX bytes:2165102153 (2.0 GiB)
Interrupt:32 Base address:0x6000
eth1 Link encap:Ethernet HWaddr 08:31:9D:4B:98:H6
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:509769 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:25435857 (24.2 MiB) TX bytes:0 (0.0 b)
Interrupt:36 Base address:0xa100
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1090579 errors:0 dropped:0 overruns:0 frame:0
TX packets:1090579 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:293214254 (279.6 MiB) TX bytes:293214254 (279.6 MiB)
Here eth0 is first interface with ip 192.168.1.1 and eth1 the second interface with no ip addess. lo is the local loopback interface.
Step 3. Change/Assign ip address to interfaces.
Commands:
"cd /etc/sysconfig/network-scripts/"
Edit ifcfg-eth0
Sample File Content:
---------------------------------------
DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.1.1
NETMASK=255.255.255.0
ONBOOT=yes
TYPE=Ethernet
GATEWAY=192.168.1.10
HWADDR=77:03:8e:80:31:f5
---------------------------------------
Save the file.
Step 4. Restart network service.
To update the new setting restart the network service.
Command: "service network restart"
Induvidual interfaces can be restarted using Commads: "ifdown ifcfg-eth0" and "ifup ifcfg-eth0".
Step 5. Creating a virtual interface.
Command: "cp ifcfg-eth0 ifcfg-eth0:1"
Edit ifcfg-eth0:1 file
---------------------------------------
DEVICE=eth0:1
BOOTPROTO=static
IPADDR=172.16.0.1
NETMASK=255.255.255.0
ONBOOT=yes
TYPE=Ethernet
HWADDR=77:03:8e:80:31:f5
---------------------------------------
Command: "ifup ifcfg-eth0:1"
You will have a new virtual interface eth0:1 up with ip address 172.16.0.1.
Command : "lspci | grep Ethernet"
Sample Output:
00:04.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 20)
00:05.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 20)
Step 2: Check if the linux kernel have identified and loaded the devices.
Command: "ifconfig -a"
Sample Output:
eth0 Link encap:Ethernet HWaddr 77:03:8e:80:31:f5
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8585824 errors:0 dropped:86 overruns:0 frame:0
TX packets:2926444 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1499815123 (1.3 GiB) TX bytes:2165102153 (2.0 GiB)
Interrupt:32 Base address:0x6000
eth1 Link encap:Ethernet HWaddr 08:31:9D:4B:98:H6
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:509769 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:25435857 (24.2 MiB) TX bytes:0 (0.0 b)
Interrupt:36 Base address:0xa100
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1090579 errors:0 dropped:0 overruns:0 frame:0
TX packets:1090579 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:293214254 (279.6 MiB) TX bytes:293214254 (279.6 MiB)
Here eth0 is first interface with ip 192.168.1.1 and eth1 the second interface with no ip addess. lo is the local loopback interface.
Step 3. Change/Assign ip address to interfaces.
Commands:
"cd /etc/sysconfig/network-scripts/"
Edit ifcfg-eth0
Sample File Content:
---------------------------------------
DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.1.1
NETMASK=255.255.255.0
ONBOOT=yes
TYPE=Ethernet
GATEWAY=192.168.1.10
HWADDR=77:03:8e:80:31:f5
---------------------------------------
Save the file.
Step 4. Restart network service.
To update the new setting restart the network service.
Command: "service network restart"
Induvidual interfaces can be restarted using Commads: "ifdown ifcfg-eth0" and "ifup ifcfg-eth0".
Step 5. Creating a virtual interface.
Command: "cp ifcfg-eth0 ifcfg-eth0:1"
Edit ifcfg-eth0:1 file
---------------------------------------
DEVICE=eth0:1
BOOTPROTO=static
IPADDR=172.16.0.1
NETMASK=255.255.255.0
ONBOOT=yes
TYPE=Ethernet
HWADDR=77:03:8e:80:31:f5
---------------------------------------
Command: "ifup ifcfg-eth0:1"
You will have a new virtual interface eth0:1 up with ip address 172.16.0.1.
No comments:
Post a Comment