debian12 最小化安装后,配置静态ip

debian12 最小化安装后,配置静态ip

配置静态ip

  1. 检查那个网口是配置好线路的.
  2. 给目标网口配置ip
root@debian:~# cat  /etc/network/interfaces.d/ifcfg-enp59s0f0
auto enp59s0f0
iface enp59s0f0 inet static
    address 192.168.11.53
    netmask 255.255.248.0
    gateway 192.168.8.254
  1. 重启网络
systemctl restart networking.service
  1. 检查ip
root@debian:~# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute
       valid_lft forever preferred_lft forever
2: enp63s0f2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 2c:f0:5d:bc:1b:56 brd ff:ff:ff:ff:ff:ff
3: enp63s0f3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 2c:f0:5d:bc:1b:57 brd ff:ff:ff:ff:ff:ff
4: enp59s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 58:53:c0:66:03:d0 brd ff:ff:ff:ff:ff:ff
    inet 192.168.11.53/21 brd 192.168.15.255 scope global enp59s0f0
       valid_lft forever preferred_lft forever
    inet6 fe80::5a53:c0ff:fe66:3d0/64 scope link
       valid_lft forever preferred_lft forever
5: enp59s0f1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 58:53:c0:66:03:d1 brd ff:ff:ff:ff:ff:ff
root@debian:~# ip route
default via 192.168.8.254 dev enp59s0f0 onlink
192.168.8.0/21 dev enp59s0f0 proto kernel scope link src 192.168.11.53
root@debian:~#

配置阿里云镜像源

root@debian:~# cat /etc/apt/sources.list
deb http://mirrors.aliyun.com/debian/ bookworm main non-free-firmware contrib
deb-src http://mirrors.aliyun.com/debian/ bookworm main non-free-firmware contrib
deb http://mirrors.aliyun.com/debian-security/ bookworm-security main
deb-src http://mirrors.aliyun.com/debian-security/ bookworm-security main
deb http://mirrors.aliyun.com/debian/ bookworm-updates main non-free-firmware contrib
deb-src http://mirrors.aliyun.com/debian/ bookworm-updates main non-free-firmware contrib
deb http://mirrors.aliyun.com/debian/ bookworm-backports main non-free-firmware contrib
deb-src http://mirrors.aliyun.com/debian/ bookworm-backports main non-free-firmware contrib

如果新安装的debian 可能没有安装 resolvconf, 无法解析域名.

这个时候可以先在别的机器测试mirrors.aliyun.com的ip是多少,然后配置到 /etc/hosts

root@debian:~# grep mirror /etc/hosts
218.77.200.227 mirrors.aliyun.com
root@debian:~#

安装resolvconf

apt update
apt install resolvconf

配置dns解析

root@debian:~# cat /etc/resolvconf/resolv.conf.d/base
nameserver 114.114.114.114
root@debian:~#

重启resolveconf

systemctl restart resolvconf

配置zh_CN.utf8

# 查看可以使用的编码
root@debian:~# locale -a
C
C.utf8
en_HK.utf8
POSIX
root@debian:~#

# 增加zh_CN.utf8 编码
dpkg-reconfigure locales
# 选择zh_CN.utf8,然后ok回车.

# 再次查看
root@debian:~# locale -a
C
C.utf8
en_HK.utf8
POSIX
zh_CN.utf8

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.