suse 12 配置ip,dns,网关,hostname,ssh以及关闭防火墙

简介: suse 12 配置ip,dns,网关,hostname,ssh以及关闭防火墙
suse-linux:~ # cat /etc/issue
Welcome to SUSE Linux Enterprise Server 12 SP3  (x86_64) - Kernel \r (\l).
suse-linux:~ # uname -a
Linux suse-linux 4.4.73-5-default #1 SMP Tue Jul 4 15:33:39 UTC 2017 (b7ce4e4) x86_64 x86_64 x86_64 GNU/Linux
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
-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

配置ip,dns,网关

配置ip
suse-linux:/etc/sysconfig/network # cat ifcfg-eth0
BOOTPROTO='static'           # 网络模式:dhcp(自动获取)、static(静态,或者none也可以)
BROADCAST=''
ETHTOOL_OPTIONS=''
IPADDR='192.168.10.150/24'   # IP地址
MTU=''
NAME=''
NETMASK=''
NETWORK=''
REMOTE_IPADDR=''
STARTMODE='auto'             # 开机启动网卡
DHCLIENT_SET_DEFAULT_ROUTE='yes'
PREFIXLEN=''
配置网关
suse-linux:/etc/sysconfig/network # vim ifroute-eth0    # 这个文件需要自己创建
default 192.168.10.2 - eth0
配置dns
suse-linux:/etc/sysconfig/network # cat /etc/resolv.conf
### /etc/resolv.conf file autogenerated by netconfig!
#
# Before you change this file manually, consider to define the
# static DNS configuration using the following variables in the
# /etc/sysconfig/network/config file:
#     NETCONFIG_DNS_STATIC_SEARCHLIST
#     NETCONFIG_DNS_STATIC_SERVERS
#     NETCONFIG_DNS_FORWARDER
# or disable DNS configuration updates via netconfig by setting:
#     NETCONFIG_DNS_POLICY=''
#
# See also the netconfig(8) manual page and other documentation.
#
# 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
PING www.a.shifen.com (180.101.49.12) 56(84) bytes of data.
64 bytes from 180.101.49.12: icmp_seq=1 ttl=128 time=27.6 ms
--- www.a.shifen.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 27.625/27.625/27.625/0.000 ms

hostname

# 之所以提到hostname,是因为最近使用的时候,因为是自己测试使用,没有配置静态ip,导致机器重启,hostname变了,强迫症不喜欢,百度了好多,都是修改hosts文件,就自己尝试了修改dhcp配置文件后,得到了解决,因此更新一下
# 静态IP
suse-linux:~ # hostnamectl set-hostname suse-linux --static
# dhcp IP   // dhcp获取的ip,当机器重启的时候,hostname会变成bogon,导致修改的hostname会不生效,但是/etc/HOSTNAME文件中,hostname依旧是设置的hostname,有以下解决方法
suse-linux:~ # vim /etc/sysconfig/network/dhcp
DHCLIENT_HOSTNAME_OPTION=""    # 默认是AUTO,会影响hostname

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)

总结

初次使用suse很不习惯,虽然有很多命令和centos是一样的,但是极个别的还是不太一样:
1、suse的软件安装方式使用的是zypper,而centos是yum(很多服务只好选择编译或者二进制的方式部署了)
2、suse的静态网卡配置也和centos不一样(当时配的我有点蒙圈)
3、suse的firewalld服务器名称和centos不一样
4、suse默认关闭selinux(这点很赞啊,centos如果disabled掉还需要重启机器,贼烦)
5、suse有的时候命令行会有小bug,会导致命令不存在(多敲几次回车就好了~~~)
6、suse终端默认显示的红色挺好看的(颜狗只看外表,不看其他的)
慢慢和suse磨合磨合
链接:https://pan.baidu.com/s/1eytly8SMc2mXQN8KkjvBuQ 
提取码:9kzm 
最后分享一下suse12的vmware环境('仅供自己学习使用,切勿用于商业用途,若出现法律责任,本人概不负责')


目录
相关文章
|
9月前
|
网络协议 Linux 网络安全
CentOS防火墙管理:查询与配置开放端口的技巧
遵循以上步骤,CentOS系统管理员能够灵活地查询和管理系统端口的开放情况,并且能适用于大多数防火墙管理场合。务必在改变防火墙规则后认真审核和测试,以确保网络安全性与服务的正常运行。
1508 0
|
12月前
|
Ubuntu 安全 Linux
CentOS与Ubuntu中防火墙配置命令集汇
有了这些,你就能遨游在 CentOS 和 Ubuntu 的海洋中,频繁地改变你的防火墙设置,快速地应对各种安全威胁,同时也能保证你的系统可以正常工作。出发吧,勇敢的编程者,随着这些命令集的涌动,扬帆起航,走向安全的网络世界!
416 5
|
运维 安全 Linux
全面提升系统安全:禁用不必要服务、更新安全补丁、配置防火墙规则的实战指南
全面提升系统安全:禁用不必要服务、更新安全补丁、配置防火墙规则的实战指南
800 12
|
监控 安全 网络安全
Windows Defender防火墙配置错误与GPO:梳理关键点
许多企业的网络中包含Windows Defender防火墙、GPO和AD基础设施等组件,这些组件可能存在漏洞,一旦被利用,可能引发连锁反应,导致严重后果。本文介绍了如何识别和减少网络中的弱点,通过优化默认设置、配置GPO来加强Windows Defender防火墙的安全性,并使用SIEM工具进行日志管理和网络监控,以提高整体网络安全水平。
138 0
|
监控 网络协议 Shell
ip和ip网段攻击拦截系统-绿叶结界防火墙系统shell脚本
这是一个名为“小绿叶技术博客扫段攻击拦截系统”的Bash脚本,用于监控和拦截TCP攻击。通过抓取网络数据包监控可疑IP,并利用iptables和firewalld防火墙规则对这些IP进行拦截。同时,该系统能够查询数据库中的白名单,确保合法IP不受影响。此外,它还具备日志记录功能,以便于后续分析和审计。
367 6
|
网络安全
配置多台机器SSH相互通信信任
1.5台机器执行 ssh-keygen [root@sht-sgmhadoopnn-01 ~]# ssh-keygen Generating public/private rsa key pair.
1784 0
|
网络安全
|
网络安全 Linux 数据安全/隐私保护
不能成功配置ssh信任,提示Agent admitted failure to sign using the key.
不能成功配置ssh信任,提示Agent admitted failure to sign using the key. 问题现象:      做完信任之后要需要输密码: [grid@db01 .
1686 0
|
7月前
|
Linux 网络安全 Docker
盘古栈云,创建带ssh服务的linux容器
创建带ssh服务的linux容器
435 146