SUSE Linux Enterprise Server 12 SP5 配置静态IP

背景介绍

近期看到的一道面试题,要求使用Suse系统。由于我之前没有接触过Suse系统,记录下如何配置IP地址。(环境是VMware Fusion虚拟机)

参考文档

SuSE 12 SP5配置静态IP地址 - 魔幻小生 - 博客园 (cnblogs.com)

具体步骤

查看系统版本

linux-nvlm:/etc/sysconfig/network # hostnamectl 
   Static hostname: linux-nvlm.suse
Transient hostname: linux-nvlm
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 2351d97898ae5dfa41c79a396582d186
           Boot ID: 56e7558916a142a6a93a359e807c32fd
    Virtualization: vmware
  Operating System: SUSE Linux Enterprise Server 12 SP5
       CPE OS Name: cpe:/o:suse:sles:12:sp5
            Kernel: Linux 4.12.14-120-default
      Architecture: arm64

设置静态IP地址

linux-nvlm:~ # cat  /etc/sysconfig/network/ifcfg-eth0
BOOTPROTO='static'
BROADCAST=''
ETHTOOL_OPTIONS=''
IPADDR='10.0.0.20'
MTU=''
NAME=''
NETMASK='255.255.255.0'
NETWORK='10.0.0.2'
REMOTE_IPADDR=''
STARTMODE='auto'
DHCLIENT_SET_DEFAULT_ROUTE='yes'

设置网关

linux-nvlm:/etc/sysconfig/network # ls
config  dhcp  if-down.d  if-up.d  ifcfg-eth0  ifcfg-lo  ifcfg.template  providers  routes  scripts
linux-nvlm:/etc/sysconfig/network # cat routes  # 若不存在该文件则创建
default 10.0.0.2

设置DNS

linux-nvlm:/etc/sysconfig/network # cat /etc/resolv.conf
### /etc/resolv.conf file autogenerated by netconfig!
# 省略中间大量注释的内容......
nameserver 223.5.5.5

配置完成后重启网络服务即可

systemctl restart network

开启ssh

linux-nvlm:/etc/sysconfig/network # grep -Ev '^$|^#' /etc/ssh/sshd_config
PermitRootLogin yes 
PasswordAuthentication yes
#其他内容省略

systemctl restart sshd

关闭防火墙

linux-nvlm:/etc/sysconfig/network # systemctl disable SuSEfirewall2 --now
posted @ 2024-01-17 14:22  热气球!  阅读(328)  评论(0编辑  收藏  举报