ip
comandos
mi ip local
ip addr show eth0 | grep 'inet ' | awk '{print $2}' | cut -f1 -d'/' ip addr show
- ifconfig -a
- ip addr (ip a)
- hostname -I | awk '{print $1}'
- ip route get 1.2.3.4 | awk '{print $7}'
- (Fedora) Wifi-Settings→ click the setting icon next to the Wifi name that you are connected to → Ipv4 and Ipv6 both can be seen
- nmcli -p device show
mi ip pública
- curl ifconfig.me
- curl -4/-6 icanhazip.com
- curl ipinfo.io/ip
- curl api.ipify.org
- curl checkip.dyndns.org
- dig +short myip.opendns.com @resolver1.opendns.com
- host myip.opendns.com resolver1.opendns.com
- curl ident.me
- curl bot.whatismyipaddress.com
- curl ipecho.net/plain
ip manual temporal
ip manual fija
- /etc/network/interfaces
allow-hotplug eth0 iface eth0 inet static address 192.168.1.4 # este es mi caso netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1 ### static routing ### # añade una ruta a la red 10.0.0.0/8 a través del Gateway 10.9.38.65 post-up route add -net 10.0.0.0 netmask 255.0.0.0 gw 10.9.38.65 pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 10.9.38.65
Versiones posteriores:
- /etc/dhcpdc.conf
interface eth0 static ip_address=192.168.1.141/24 static routers=192.168.1.1 static domain_name_servers=192.168.1.1
En RedHat está en /etc/sysconfig/network-scripts/ifcfg-eth?
para añadir un «IP Alias» (otra IP, vamos):
- /etc/network/interfaces
auto eth0:0 iface eth0:0 inet static address 192.168.1.5 # este es mi caso netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1