매번 서버 설정시에 필요로 하지만 정작 기본 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 eth0 iface eth0 inet static |
CentOS & Fedora
# /etc/sysconfig/network-scripts/ifcfg-eth0
# Configuration for eth0 |
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] [Network] |
OpenSUSE
# /etc/sysconfig/network/ifcfg-eth0
BOOTPROTO=’static’ STARTMODE=’onboot’ IPADDR=’192.168.100.5′ NETMASK=’255.255.255.0′ |