# apt install iproute2 $ ip link show # ip link set enp0s3 up # ip addr add 172.16.1.X/24 dev enp0s3 # ip addr show dev enp0s3 # ip route add default via 172.16.1.254 # ip addr del 172.16.1.X/24 dev enp0s3 # ip addr flush dev enp0s3
# dhclient enp0s3 # ip a
ubuntu# apt install net-tools # ifconfig -a # ifconfig eth0 inet 172.16.1.X/24 # route add default gw 172.16.1.254
# hostname server.corpX.un
# ip link show # ip a # ifconfig -a # ethtool eth0 # ethtool -s eth1 speed 100 duplex full # ethtool -s eth1 autoneg on # arp -n # ip n s # ip n f all # netstat -rn # ip r # ping 8.8.8.8 # tracepath -n ya.ru # netstat -tupan # lsof -i -P # ss -anptu # ss -lnp | grep ':80' # количество подключений с каждого адреса (https://serverfault.com/questions/421310/check-the-number-of-active-connections-on-port-80) # ss -tn src :80 or src :443 | tr -s ' ' | cut -d ' ' -f5 | cut -d ':' -f1 | sort | uniq -c | sort -n
# hostnamectl set-hostname server.corpX.un # cat /etc/hostname
server.corpX.un
# cat /etc/hosts </code>
127.0.0.1 localhost 172.16.1.X server.corpX.un server
# apt remove resolvconf # cat /etc/resolv.conf
nameserver 172.16.1.254 search corpX.un
# cat /etc/network/interfaces
auto lo iface lo inet loopback auto enp0s3 iface enp0s3 inet static address 172.16.1.X netmask 255.255.255.0 gateway 172.16.1.254 # apt install resolvconf # dns-nameservers 172.16.1.254 # dns-search corpX.un ### Alias example ### # auto eth0:0 # iface eth0:0 inet static # address 192.168.1.10 # netmask 255.255.255.0 ### Bridge example ### ### http://bwachter.lart.info/linux/bridges.html ### ### ### https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1812219.html ### В Debian 11 требуется Promoskye режим в виртуализации ### # apt install bridge-utils # auto br0 # iface br0 inet static # address 172.16.1.X # netmask 255.255.255.0 # gateway 172.16.1.254 # bridge_ports eth0 eth1 # bridge_stp off # bridge_maxwait 5 # post-up /sbin/brctl setfd br0 0 ### 802.1q example ### # apt install vlan # auto vlan2 # iface vlan2 inet static # address 192.168.100+X.1 # netmask 255.255.255.0 # mtu 1500 # vlan_raw_device eth0 ### UP iface without ip example ### # auto eth1 # iface eth1 inet manual # up ip link set eth1 up
# ifup enp0s3 # ifdown --force enp0s3
client1# dhclient eth0 client1# cat /etc/hostname
client1
client1# :> /etc/resolv.conf
или Команда chattr
client1# cat /etc/hosts
127.0.0.1 localhost 127.0.1.1 client1
# cat /etc/network/interfaces
auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp
# apt install network-manager
# apt purge cloud-init
apt purge ifupdown
# netplan status --all # cat /etc/netplan/01-netcfg.yaml
network: version: 2 ethernets: enp0s3: addresses: [172.16.1.200+X/24] gateway4: 172.16.1.254 # routes: # - to: default # via: 172.16.1.254 # nameservers: # addresses: [172.16.1.254]
# netplan try # netplan apply
# apt install ifupdown net-tools ubuntu20/22# rm /etc/netplan/00-installer-config.yaml ubuntu24# rm /etc/netplan/50-cloud-init.yaml
# cat /etc/resolv.conf
search corpX.un nameserver 127.0.0.53
# resolvectl status или # systemd-resolve --status # cat /etc/systemd/resolved.conf
[Resolve] DNS=172.16.1.254
# systemctl restart systemd-resolved
# systemctl disable systemd-resolved # systemctl stop systemd-resolved # rm /etc/resolv.conf # this is link
# cat /etc/hostname
server.corpX.un
# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# HWADDR=00:0C:29:C0:F8:54 DEVICE=eth0 ONBOOT=yes BOOTPROTO=static IPADDR=172.16.1.100+X NETMASK=255.255.255.0 DNS1=172.16.1.254 DOMAIN=corpX.un GATEWAY=172.16.1.254
# cat /etc/sysconfig/network-scripts/ifcfg-eth0:0
DEVICE=eth0:0 BOOTPROTO=static ONBOOT=yes # HWADDR=00:0C:29:C0:F8:54 IPADDR=10.N.M.100+X NETMASK=255.255.255.0
Для Centos 6
# cat /etc/sysconfig/network
# NETWORKING=yes # NETWORKING_IPV6=no # HOSTNAME=centos.corpX.un # GATEWAY=172.16.1.254
# hostname centos.corpX.un # ifup enp0s3
# cat /etc/conf.d/hostname
hostname="server.corpX.un"
# cd /etc/init.d # ln -s net.lo net.enp0s3
# cat /etc/conf.d/net
config_enp0s3="172.16.1.X/24" routes_enp0s3="default via 172.16.1.254"
# rc-update add net.enp0s3 default
root@nessus.isp.un:~# host ru.archive.ubuntu.com
ru.archive.ubuntu.com is an alias for mirror.yandex.ru. mirror.yandex.ru has address 213.180.204.183 mirror.yandex.ru has IPv6 address 2a02:6b8:0:201::1
root@nessus.isp.un:~# cat /etc/gai.conf
... precedence 2a02:6b8::/32 0 ...
# apt install ifenslave # cat /etc/network/interfaces
auto lo iface lo inet loopback iface eth0 inet manual iface eth1 inet manual auto bond0 iface bond0 inet static address 192.168.X.10 netmask 255.255.255.0 gateway 192.168.X.1 slaves eth0 eth1 bond-mode active-backup bond-miimon 100 bond-primary eth0
# cat /etc/netplan/01-netcfg.yaml
network: version: 2 bonds: bond0: addresses: [192.168.X.10/24] gateway4: 192.168.X.1 interfaces: [eth0, eth1] parameters: mode: active-backup mii-monitor-interval: 100 primary: eth0 ethernets: eth0: {} eth1: {}
# cat /proc/net/bonding/bond0