ip configuration
يكشنبه, ۲۲ بهمن ۱۳۹۶، ۱۰:۵۴ ب.ظ
1-IP(OnBoot-Permanent)-dhcp-debian
- auto eth0
- iface eth0 inet dhcp
2-IP(OnBoot-Permanent)-static-debian
- auto eth0
- iface eth0 inet static
- address 192.168.50.2
- netmask 255.255.255.0
- gateway 192.168.50.1
- dns-nameservers 192.168.200.1
3-IP(OnBoot-Permanent)-dhcp-redhat
- DEVICE=eth0
- TYPE=Ethernet
- ONBOOT=yes
- BOOTPROTO=dhcp
- IPV4_FAILURE_FATAL=yes
- NAME="System eth0"
service network restart
or
nmcli dev disconnect ${device}
nmcli con reload ${device}
nmcli con up ${device}
4-IP(OnBoot-Permanent)-static-redhat
- DEVICE="eth0"
- BOOTPROTO=static
- ONBOOT=yes
- TYPE="Ethernet"
- IPADDR=192.168.50.2
- NAME="System eth0"
- HWADDR=00:0C:29:28:FD:4C
- GATEWAY=192.168.50.1
- [PEERDNS=no (then add DNS to /etc/resolv.conf)]
- or [DNS1=8.8.8.8] and
- [DNS2=8.8.4.4]]
service network restart
or
nmcli dev disconnect ${device}
nmcli con reload ${device}
nmcli con up ${device}
5-VirtualIP-(OnBoot-Permanent)-debian-static
- iface eth0:0 inet static
- address 123.123.22.22
- netmask 255.0.0.0
- broadcast 123.255.255.255
6-VirtualIP-(OnBoot-Permanent)-debian-DHCP
- iface eth0:0 inet dhcp
7-virtualIP-(OnBoot-Permanent)-Redhat-static
- DEVICE=eth0:0
- IPADDR=123.123.22.22
- NETMASK=255.0.0.0
- NETWORK=123.0.0.0
- BROADCAST=123.255.255.255
- ONBOOT=yes
service network restart
or
nmcli dev disconnect ${device}
nmcli con reload ${device}
nmcli con up ${device}
8-virtualIP-(OnBoot-permanent)-Redhat-DHCP
- DEVICE=eth0:0
- BOOTPROTO=dhcp
- ONBOOT=yes
service network restart
or
nmcli dev disconnect ${device}
nmcli con reload ${device}
nmcli con up ${device}
9-IP(Not permanent)-ifconfig
- ifconfig -a #show all Interface and details
- ifconfig enp6s0 down #set off interface
- ifconfig enp6s0 up #set on interface
- ifconfig enp6s0 192.168.2.24 #set ip to interface
- ifconfig enp6s0 netmask 255.255.255.0 #set subnetmask
- ifconfig enp6s0 mtu 9000 #set mtu
- ifconfig enp6s0:0 192.168.2.25 #set secondary ip (virtual)
- ifconfig eth0:0 down #set off virtual ip
10-IP(Not permanent)-ip
- ip a #show all Interface and details
- ip link set eth0 down #set Off interface
- ip link set eth0 up #set on interface
- ip addr add 192.168.2.24/24 dev eth0 #set ip to interface
- ip link set eth0 mtu 9000 #set mtu
- ip addr del 192.168.1.1/24 dev eth0 #set Off interface
- ip addr show eth0
نکته: از دستور زیر برای استفاده در توزیعهای ردهت استفاده میشود:
system-config-network-tui