De Wiki inetshell
Saltar a: navegación, buscar

How to Setup network on centos 7

Manual[editar]

Usando comandos ifconfig/route[editar]

  • Asignar IP
 ifconfig eth0 up 192.168.0.1/24
  • Asignar gateway
 route add default gw 192.168.0.254 eth0
  • Configurar DNS
 vi /etc/resolv.conf
 nameserver 8.8.8.8

Usando comando ip[editar]

  • Asignar IP
 ip addr add 192.168.0.1/24 dev eth0
  • Asignar gateway
 ip route add default via 192.168.0.254
  • Configurar DNS
 vi /etc/resolv.conf
 nameserver 8.8.8.8

Linux route Add Command Examples

Red Hat ip command cheatsheet

Usando nmtui[editar]

https://lintut.com/how-to-setup-network-after-rhelcentos-7-minimal-installation/

nmtui
systemctl restart network

CentOS7[editar]

http://www.mustbegeek.com/configure-static-ip-address-in-centos/

BOOTPROTO=static
IPADDR=192.168.0.1
NETMASK=255.255.255.0
GATEWAY=192.168.0.254
DEVICE=eth0
HWADDR=aa:bb:cc:dd:ee:ff
NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
USERCTL=no

Agregar ruta estatica[editar]

https://my.esecuredata.com/index.php?/knowledgebase/article/2/add-a-static-route-on-centos

cat << END > /etc/sysconfig/network-scripts/route-eth0
10.0.0.0/8 via 10.0.0.254 dev eth0
END

Agregar IP adicional[editar]

https://whstatic.1and1.com/help/CloudServer/EN-US/d851230.html

Ubuntu[editar]

https://www.2daygeek.com/how-to-add-additional-ip-secondary-ip-in-ubuntu-debian-system/

  • /etc/network/interfaces
iface enp0s3 inet static
address 192.168.56.202
netmask 255.255.255.0

iface enp0s3 inet static
address 192.168.56.203
netmask 255.255.255.0

iface enp0s3 inet static
address 192.168.56.204
netmask 255.255.255.0