Software: Apache/2.4.53 (Unix) OpenSSL/1.1.1o PHP/7.4.29 mod_perl/2.0.12 Perl/v5.34.1. PHP/7.4.29 uname -a: Linux vps-2738122-x 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 uid=1(daemon) gid=1(daemon) grupos=1(daemon) Safe-mode: OFF (not secure) /usr/local/sbin/ drwxr-xr-x | |
| Viewing file: Select action/file-type: #!/bin/bash
config_network_debian() {
test -f /etc/network/interfaces.d/eth1 || {
cat > /etc/network/interfaces.d/eth1 <<EOF
allow-hotplug eth1
iface eth1 inet dhcp
EOF
ifup eth1
}
}
config_network_sysconfig() {
test -f /etc/sysconfig/network-scripts/ifcfg-eth1 || {
cat > /etc/sysconfig/network-scripts/ifcfg-eth1 <<EOF
DEVICE=eth1
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=no
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=no
IPV6_DEFROUTE=no
IPV6_FAILURE_FATAL=no
NAME=eth1
ONBOOT=yes
EOF
ifup eth1
}
}
config_network_NetworkManager() {
nmcli connection delete eth1 2> /dev/null
nmcli connection add connection.interface-name "eth1" type ethernet connection.id "eth1" ipv4.method "auto" ipv4.never-default "yes" ipv6.method "disabled"
nmcli connection up eth1
}
config_network_netplan() {
test -f /etc/netplan/02-eth1.yaml || {
cat > /etc/netplan/02-eth1.yaml <<EOF
network:
version: 2
renderer: networkd
ethernets:
eth1:
dhcp4: yes
EOF
chmod 600 /etc/netplan/02-eth1.yaml
netplan apply
}
}
if grep -qw eth1 /proc/net/dev ; then
## Debian 8, 9 y 10, Ubuntu 16.04
grep -qs "Debian GNU/Linux " /etc/os-release && config_network_debian
grep -qs "Ubuntu 16\.04" /etc/os-release && config_network_debian
## CentOS 6 y 7
grep -qs "CentOS Linux release 7\." /etc/redhat-release && config_network_sysconfig
grep -qs "CentOS release 6\." /etc/redhat-release && config_network_sysconfig
## CentOS/Alma/Rocky 8
egrep -qs "(CentOS |Alma|Rocky )Linux release 8" /etc/redhat-release && config_network_netplan
## CentOS/Alma/Rocky 9
egrep -qs "(CentOS |Alma|Rocky )Linux release 9" /etc/redhat-release && config_network_NetworkManager
## Ubuntu 18, 20, 22, y 24
egrep -qs "Ubuntu (18|20|22|24)\.04" /etc/os-release && config_network_netplan
else
rm -vf /etc/network/interfaces.d/eth1 /etc/sysconfig/network-scripts/ifcfg-eth1 /etc/netplan/02-eth1.yaml
fi
|
:: Command execute :: | |
--[ c99shell v. 2.1 [PHP 8 Update] [02.02.2022] maintained byC99Shell Github | Generation time: 0.643 ]-- |