hostnamectl set-hostname student-pc-01.lab.technopark-rgsu.ru
cat > /etc/net/ifaces/enp60s0/resolv.conf <<'EOF'
nameserver 192.168.0.20
EOF
cp -a /etc/resolvconf.conf /etc/resolvconf.conf.bak
python3 - <<'PY'
from pathlib import Path
path = Path("/etc/resolvconf.conf")
text = path.read_text() if path.exists() else ""
settings = {
"interface_order": "'lo lo[0-9]* lo.* enp60s0'",
"search_domains": "lab.technopark-rgsu.ru",
}
lines = text.splitlines()
result = []
found = set()
for line in lines:
stripped = line.strip()
replaced = False
for key, value in settings.items():
if stripped.startswith(f"{key}="):
result.append(f"{key}={value}")
found.add(key)
replaced = True
break
if not replaced:
result.append(line)
for key, value in settings.items():
if key not in found:
result.append(f"{key}={value}")
path.write_text("\n".join(result) + "\n")
PY
resolvconf -u