Cheatsheet: Difference between revisions

Content added Content deleted
Line 1,232: Line 1,232:


=== IP ===
=== IP ===

*Show info
ip addr show (ip a)
ip addr show (ip a)
ifconfig
ifconfig
Line 1,238: Line 1,240:
ip route get 8.8.8.8 | head -1 | cut -d' ' -f7
ip route get 8.8.8.8 | head -1 | cut -d' ' -f7


IP Alias:
*Assign IP CentOS:
nano /etc/sysconfig/network-scripts/ifcfg-eth0
ifconfig eth0:test 192.168.66.1
DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.1.2
NETMASK=255.255.255.0
ONBOOT=yes


*Ubuntu
VLAN:
sudo nano /etc/network/interfaces

auto ens31
iface ens31 inet dhcp

auto ens33
iface ens33 inet static
address 192.168.0.2
netmask 255.255.255.0
network 192.168.0.0
broadcst 192.168.0.255
gateway 192.168.0.1
dns-nameservers 192.168.0.3

*Other methods:
ifconfig eth0 10.10.10.45 netmask 255.255.255.0 up
ip addr add 10.20.30.176/24 dev eth0

*IP Alias:
ifconfig eth0:100 192.168.66.1

*VLAN:
vconfig add eth0 700
vconfig add eth0 700
ifconfig eth0.700 192.168.66.1
ifconfig eth0.700 192.168.66.1

*VLAN & Alias:
auto eth0.10
iface eth0.10 inet static
address 192.168.1.61
netmask 255.255.255.0
gateway 192.168.1.11

auto eth0.10:1
iface eth0.10:1 inet static
address 10.20.100.100
netmask 255.255.255.0

auto eth0.10:2
iface eth0.10:2 inet static
address 10.20.100.200
netmask 255.255.255.0