MyTetra Share
Делитесь знаниями!
IP configuration
Время создания: 11.09.2017 18:00
Текстовые метки: ip, ifconfig
Раздел: root - Linux

RHEL:


The default ethernet interface file is located at /etc/sysconfig/network-scripts/ifcfg-eth0. You can configure a static IP address by editing the following lines, substituting your own IP addresses, gateways, and DNS resolvers:

***** BEGIN /etc/sysconfig/network-scripts/ifcfg-eth0*****

# Edit this line from "dhcp" to "none":

BOOTPROTO=none


# Edit from "yes" to "no":

PEERDNS=no


...


# Add the following lines:

DOMAIN=members.linode.com


# We specifically want GATEWAY0 here, not

# GATEWAY without an interger following it.

GATEWAY0=198.51.100.1


DNS1=203.0.113.1

DNS2=203.0.113.2

DNS3=203.0.113.3


# Your primary public IP address. The netmask

# is taken from the PREFIX (where 24 is a

# public IP, 17 is a private IP)

IPADDR0=198.51.100.5

PREFIX0=24


# To add a second public IP address:

IPADDR1=198.51.100.10

PREFIX1=24


# To add a private IP address:

IPADDR2=192.0.2.6

PREFIX2=17

***** END /etc/sysconfig/network-scripts/ifcfg-eth0*****


To load your changes, restart the network service:


sudo systemctl restart network




DEBIAN:


Add the following to the interface configuration file:

*** BEGIN /etc/network/interfaces ***

# Your primary public IP address.

auto eth0

iface eth0 inet static

address 198.51.100.5/24

gateway 198.51.100.1


# To add a second public IP address:

iface eth0 inet static

address 198.51.100.10/24


# To add a private IP address:

iface eth0 inet static

address 192.0.2.6/17

*** END /etc/network/interfaces ***


To enable name resolution, populate resolv.conf with your DNS IP addresses and resolv.conf options (see man 5 resolv.conf). The domain, search and options lines aren’t necessary, but useful to have.


*** BEGIN /etc/resolv.conf ***

nameserver 203.0.113.1

nameserver 203.0.113.2

nameserver 203.0.113.3

domain members.linode.com

search members.linode.com

options rotate

*** END /etc/resolv.conf ***


By default, Debian doesn’t include Network Manager or resolvconf to manage /etc/resolv.conf. In this situation, it’s all right to edit resolv.conf because nothing will overwrite your changes on a reboot or restart of networking services. Also be aware that resolv.conf can only use up to three nameserver entries.


 
MyTetra Share v.0.53
Яндекс индекс цитирования