ubuntu 24.04设置静态ip

在 Ubuntu 设置静态 ip

1
	sudo vim /etc/netplan/50-cloud-init.yaml

设置内容如下:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
network:
  ethernets:
    ens33:
      dhcp4: no
      addresses:
        - 192.168.48.100/24
      optional: true
      routes:
        - to: default
          via: 192.168.48.2
      nameservers:
        addresses: [192.168.48.2]
  version: 2

接下来校验一下

1
sudo netplan try

校验通过后:

1
sudo netplan apply

ubuntu 如何 root 账户登录

1
sudo passwd root
设置sshd_config文件,sudo vi /etc/ssh/sshd_config,
将PermitRootLogin 参数改为yes。
重启ssh即可。
Licensed under CC BY-NC-SA 4.0
最后更新于 Jan 06, 2025 05:52 UTC
comments powered by Disqus
Built with Hugo
主题 StackJimmy 设计
Caret Up