Cheatsheet: Difference between revisions
→IP
(→IP) |
(→IP) |
||
Line 1,232:
=== IP ===
*Show info
ip addr show (ip a)
ifconfig
Line 1,238 ⟶ 1,240:
ip route get 8.8.8.8 | head -1 | cut -d' ' -f7
*Assign IP
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:
▲*VLAN:
vconfig add eth0 700
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
|