修改Linux基本配置
1.修改主机名
vi /etc/sysconfig/network
NETWORKING=yes HOSTNAME=server1.cn |
2.修改ip地址
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0 TYPE=Ethernet ONBOOT=yes BOOTPROTO=static IPADDR=192.168.0.101 NETMASK=255.255.255.0 |
service network restart
3.修改ip地址和主机名的映射关系
vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.0.101 server1.cn |
4.关闭iptables并设置其开机启动/不启动
service iptables stop
chkconfig iptables on
chkconfig iptables off
5.使用简单的socket 发送消息和监听端口
模拟消息推送
nc和ncat
yum install -y nmap
yum install -y nc
启动一个服务端并监听9999端口
nc -lk 9999
ncat -l 9999