1. hostname 변경
[root@rhel5 ~]# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=rhel5
[root@rhel5 ~]# cat /etc/hosts
192.168.3.9     rhel5
[root@rhel5 ~]#

2. ip 변경
[root@rhel5 ~]# ls /etc/sysconfig/network-scripts/ifcfg-eth0  < ip 설정관련 파일
[root@rhel5 ~]# ifconfig eth0 192.168.3.9 netmask 255.255.255.0 broadcast + up

3. ip alias 설정
[root@rhel5 ~]# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0
[root@rhel5 ~]# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:1
[root@rhel5 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
HWADDR=00:0c:29:5b:50:27
[root@rhel5 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0:0
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0:0
#BOOTPROTO=dhcp
ONBOOT=yes
HWADDR=00:0c:29:5b:50:27
IPADDR=192.168.3.9
[root@rhel5 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0:1
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0:1
# BOOTPROTO=dhcp
ONBOOT=yes
IPADDR=192.168.0.9
# HWADDR=00:0c:29:5b:50:27

4. /etc/resolv.conf 변경

5. service network restart
    (or)
   /etc/init.d/network restart

6. 기타 network config tool
  netcfg / netconfig / setup

7. 현재 network 상태 조회
[root@rhel5 ~]# ethtool eth0
Settings for eth0:
        Supported ports: [ TP ]
        Supported link modes:   1000baseT/Full
        Supports auto-negotiation: No
        Advertised link modes:  Not reported
        Advertised auto-negotiation: No
        Speed: 1000Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: off
        Link detected: yes

+. 리눅스 배포본별 ip 설정 파일
--- ubuntu && debian ---
/etc/network/interfaces

   -----------
# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
        address 192.168.0.5
        netmask 255.255.255.0
        gateway 192.168.0.1

# dns-*
dns-nameservers 168.126.63.1
dns-search localdomain
   -----------
/etc/init.d/networking restart

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

--- gentoo ---
/etc/conf.d/net



블로그 이미지

Melting

,