Linux network card configuration detailed

  
        

File: /etc/sysconfig/network-scripts/ifcfg-eth0

The following values ​​are common to all basic configuration files: * DEVICE=name, where name is the name of the physical device (dynamic allocation) The PPP device should be excluded, its name is "logical name". * IPADDR=addr, where addr is the IP address. * NETMASK=mask, where mask is the network mask. * NETWORK=addr, where addr is the network address * BROADCAST=addr, where addr is the broadcast address. * GATEWAY=addr, where addr is the gateway address. * ONBOOT=answer, here answer takes one of the following values: o yes -- the device will be activated at boot time. No -- The device is not activated at boot time. * USERCTL=answer, answer one of the following values: o yes -- non-root users can control the device o no -- non-root users are not allowed to control the device. * BOOTPROTO =proto, where proto takes one of the following values: o none -- does not use the boot protocol. o bootp -- uses the bootp protocol. o dhcp -- uses the dhcp protocol.

Terminal: Query the IP address: ifconfig -a modify Domain IP: 1. Log in as root 2. Modify the configuration file /etc/sysconfig/network-scripts/ifcfg-eth0

The contents of the file are as follows: \\DEVICE=eth0 HWADDR=00:0C:29:A2: 8C:B2 ONBOOT=yes TYPE=Ethernet NETMASK=255.255.255.0 IPADDR=192.168.1.11 -> Change to 192.168.1.12 GATEWAY=192.168.1.1

reboot

ifconfig eth0 new ip then Edit /etc/sysconfig/network-scripts/ifcfg-eth0, modify ip ifconfig eth0 new IP

Then edit /etc/sysconfig/network-scrIPts/ifcfg-eth0, modify IP

Modify IP address

[aeolus@db1 network-scrIPts]$ vi ifcfg-eth0

DEVICE=eth0

ONBOOT=yes

BOOTPROTO=static

IPADDR=219.136.241.211

NETMASK=255.255.255.128

GATEWAY=219.136.241.254

Second, modify the gateway

vi /etc/sysconfig/network

NETWORKING=yes

HOSTNAME=Aaron

GATEWAY=192.168.1.1

Third, modify DNS

[aeolus@db1 etc]$ vi resolv.conf

nameserver 202.96.128.68

nameserver 219.136.241.206

IV. Restart the network

/etc/init.d/network restart

Modify IP Address

Effective immediately:

# ifconfig eth0 192.168.0.20 netmask 255.255.255.0

Startup Effective:

Modify /etc/sysconfig/network-scrIPts/ifcfg-eth0

Modify default gateway

Effective immediately:

# route add default gw 192.168.0.254

Startup:

Modify /etc/sysconfig/network-scrIPts/ifcfg-eth0

Modify DNS

Modify /etc/resolv.conf

Immediately after modification, the startup is also valid

Modify host name

Effective immediately:

# hostname Fc2

Startup Effective:

Modify /etc/sysconfig/network

Copyright © Windows knowledge All Rights Reserved