Linuxネットワーク設定Redhat/CentOS/etc/sysconfig/network-scripts/ifcfg-eth0スタティック DEVICE=eth0 BOOTPROTO=static IPADDR=192.168.0.150 NETMASK=255.255.255.0 ONBOOT=yes DHCP DEVICE=eth0 BOOTPROTO=dhcp ONBOOT=yes /etc/sysconfig/networkNETWORKING=yes NETWORKING_IPV6=no HOSTNAME=localhost.localdomain GATEWAY=192.168.0.1 ネットワーク設定変更の反映RHEL/CentOS systemctl reload NetworkManager RHEL6/CentOS6 service network restart 設定確認RHEL/CentOS ip link show ip address show RHEL6/CentOS6 ifconfig 参考Ubuntu/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.150 netmask 255.255.255.0 gateway 192.168.0.1 network 192.168.0.0 broardcast 192.168.0.255 DHCP # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface allow-hotplug eth0 iface eth0 inet dhcp 詳しくはman 5 interfacesを参照する。 IPエイリアス debian
auto eth0 iface eth0 inet static address 192.168.0.2 netmask 255.255.255.0 gateway 192.168.0.1 auto eth0:0 iface eth0:0 inet static address 192.168.0.3 netmask 255.255.255.0 gateway 192.168.0.1 |
|