新安装SuSE后,配置IP相关参数

配置IP,网关,DNS等相关信息

 /etc/sysconfig/network/

suse-linux:~ # cd /etc/sysconfig/network/
suse-linux:/etc/sysconfig/network # ll
total 60
-rw-r--r-- 1 root root 9692 Nov 24 04:30 config
-rw-r--r-- 1 root root 11495 Nov 24 04:30 dhcp
drwxr-xr-x 1 root root 40 Nov 24 04:30 if-down.d
drwxr-xr-x 1 root root 66 Nov 24 04:30 if-up.d
-rw-r--r-- 1 root root 206 Nov 30 21:45 ifcfg-eth0   (配置IP,子网掩码)
-rw------- 1 root root 147 Nov 24 04:30 ifcfg-lo
-rw-r--r-- 1 root root 21738 Oct 14 2016 ifcfg.template
drwx------ 1 root root 0 Jun 27 2017 providers
drwxr-xr-x 1 root root 206 Nov 24 04:30 scripts

 

配置网关

suse-linux:/etc/sysconfig/network # vim ifroute-eth0 # 这个文件需要自己创建
default 192.168.10.2 - eth0

 

配置DNS

suse-linux:/etc/sysconfig/network # cat /etc/resolv.conf
# Note: Manual change of this file disables netconfig too, but
# may get lost when this file contains comments or empty lines
# only, the netconfig settings are same with settings in this
# file and in case of a "netconfig update -f" call.
#
### Please remove (at least) this line when you modify the file!
nameserver 192.168.10.2

 

suse-linux:~ # systemctl restart network
suse-linux:~ # ping www.baidu.com -w 1

SSH

suse-linux:~ # vim /etc/ssh/sshd_config # 下面两项打开注释,改为yes即可
PermitRootLogin yes # 允许root用户登录
PasswordAuthentication yes # 开启密码验证
suse-linux:~ # systemctl restart sshd

 

关闭防火墙(注意命令中的大小写敏感)

'suse里面的防火墙名称是SuSEfirewall2,和centos不一样'
suse-linux:~ # systemctl disbale SuSEfirewall2 --now
suse-linux:~ # systemctl status SuSEfirewall2
● SuSEfirewall2.service - SuSEfirewall2 phase 2
Loaded: loaded (/usr/lib/systemd/system/SuSEfirewall2.service; disabled; vendor preset: disabled)
Active: inactive (dead)

 

 

SUSE15后关闭防火墙命令有变化

执行:

/usr/sbin/rcfirewalld status

/usr/sbin/rcfirewalld stop

有时候如果不起作用,就先/usr/sbin/rcfirewalld start,再stop

posted on 2022-06-10 14:57  遇见阿杜  阅读(271)  评论(0编辑  收藏  举报