2011年3月31日 星期四

Linux Fedora CentOS Ubuntu TCP/IP Config

export LANG=C 設定英文語系

"setup" 指令,即可設定網卡



 指令修改網卡設定

一、 Fedora 13

vi /etc/sysconfig/networking/devices/ifcfg-eth0

# Intel Corporation 82557/8/9/0/1 Ethernet Pro 100
DEVICE=eth0
IPADDR=172.16.0.204
NETMASK=255.255.255.0
GATEWAY=172.16.0.254
DNS1=168.95.1.1
NAME="System eth0"


二、 CentOS 5.4

vi /etc/sysconfig/network-scripts/ifcfg-eth0

# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
BROADCAST=172.16.1.255
IPADDR=172.16.1.101
NETMASK=255.255.255.0
NETWORK=172.16.1.0
GATEWAY=172.16.1.254

三、 重啟網路服務

service network restart

[root@lab-linux ~]# service network restart                                               
Shutting down interface eth0:  [  OK  ]
Shutting down loopback interface:  [  OK  ]
Bringing up loopback interface:  [  OK  ]
Bringing up interface eth0:  [  OK  ]

四、確認路由

netstat -nr

[root@lab-linux ~]# netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
172.16.1.0      0.0.0.0         255.255.255.0   U         0 0          0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth0
0.0.0.0            172.16.1.254    0.0.0.0         UG        0 0          0 eth0

五、Ubuntu 11

vi /etc/network/interfaces


iface eth0 inet static
        address 172.16.1.211
        netmask 255.255.255.0
        network 172.16.1.0
        broadcast 172.16.1.255
        gateway 172.16.1.254

sudo /etc/init.d/networking restart