메뉴 닫기

운영체제별 STATIC 네트워크 설정

network
매번 서버 설정시에 필요로 하지만 정작 기본 cfg 파일이 삭제되면 헤매게 되는 네트워크 설정구성입니다. 특히나 리눅스마다 약간씩 차이가 있기에 정리해 보았습니다.

Hostname and FQDN Settings
Debian and Ubuntu
# echo “hostname” > /etc/hostname
# hostname -F /etc/hostname

CentOS/Fedora
# echo “HOSTNAME=hostname” >> /etc/sysconfig/network
# hostname “hostname”

Slackware
# echo “h정ostname” > /etc/HOSTNAME
# hostname -F /etc/HOSTNAME

Gentoo
# echo “HOSTNAME=\”hostname\”” > /etc/conf.d/hostname
# /etc/init.d/hostname restart

Arch Linux
# echo “hostname” > /etc/hostname
# hostname -F /etc/hostname

 

STATIC IP 설정

Debian and Ubuntu
# /etc/network/interfaces

# The loopback interface
auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0

iface eth0 inet static
address 192.168.100.5
gateway 192.168.100.1
netmask 255.255.255.0
dns-nameservers 168.126.63.1

 

CentOS  & Fedora
# /etc/sysconfig/network-scripts/ifcfg-eth0

# Configuration for eth0
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.100.5
NETMASK=255.255.255.0
GATEWAY=192.168.100.1
DNS=168.126.63.1

 

Gentoo
# /etc/conf.d/net

config_eth0=”192.168.100.5/24″
routes_eth0=”default gw 192.168.100.1″

 

Arch Linux
# /etc/systemd/network/50-static.network

[Match]
Name=eth0

[Network]
Address=192.168.100.5/24
Gateway=192.168.100.1

 

OpenSUSE
# /etc/sysconfig/network/ifcfg-eth0

BOOTPROTO=’static’
STARTMODE=’onboot’
IPADDR=’192.168.100.5′
NETMASK=’255.255.255.0′
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x