1, Vi指令
Vi打开指定文件,i插入修改,修改完毕,esc退出修改,:wq写入并退出,:q退出
2, 双网卡配置IP及默认网关
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth1"
BOOTPROTO="none"
HWADDR="00:50:56:B1:4C:D7"
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Ethernet"
IPADDR=192.168.3.42
NETMASK=255.255.255.0
GATEWAY=192.168.3.61
3, 配置静态路由
[root@xiaoi-robot2 ~]# vi /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
u
route add -net 192.168.41.0 netmask 255.255.255.0 gw 192.168.206.254
route add -net 192.168.45.0 netmask 255.255.255.0 gw 192.168.206.254
4, 配置DNS
[root@xiaoi-robot2 ~]# vi /etc/resolv.conf
earch localdomain
nameserver 202.103.224.68
~
5, 配置ssh端口
Vi /etc/ssh/sshd_config
#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
ListenAddress 0.0.0.0:22
ListenAddress 0.0.0.0:15631
6, 关闭防火墙
7, 从配置菜单关闭防火墙是不起作用的,索性在安装的时候就不要装防火墙
查看防火墙状态:
/etc/init.d/iptables status
暂时关闭防火墙:
/etc/init.d/iptables stop
禁止防火墙在系统启动时启动
/sbin/chkconfig --level 2345 iptables off
重启iptables:
/etc/init.d/iptables restart
题外话:
BT或者骡子速度慢用不着关防火墙,只要把相应端口开放就可以了
在文件
/etc/sysconfig/iptables
在系统原始配置的:RH-Firewall-1-INPUT规则链增加类似这样的行:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 39764 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 39764 -j ACCEPT
如果发现原有-j REJECT一类的语句,上面两句要放在它的前面
重启后生效
开启: chkconfig iptables on
关闭: chkconfig iptables off 或者 /sbin/chkconfig --level 2345 iptables off
2) 即时生效,重启后失效
service 方式
开启: service iptables start
关闭: service iptables stop
iptables方式
查看防火墙状态:
/etc/init.d/iptables status
暂时关闭防火墙:
/etc/init.d/iptables stop
重启iptables:
/etc/init.d/iptables restart
8, 重启
Reboot等