Linux questions

1.can not use ifconfig

http://blog.csdn.net/zjt289198457/article/details/6918644

   add this : export PATH=$PATH:/sbinc

   at the end of file /etc/profile

   and then execute : source /etc/profile to make the change effect

2.change to static ip
http://wkm.iteye.com/blog/1308528
2.1 change hostname to hadoop

NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=hadoop

2.2  Change ip address and Gateway 

path:/etc/sysconfig/network-scripts/ifcfg-eth0

old file:

# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)

DEVICE=eth0
BOOTPROTO=none
HWADDR=00:0c:29:d3:48:0e
ONBOOT=yes
NETMASK=255.255.0.0
IPADDR=172.27.35.222
GATEWAY=172.27.35.1
TYPE=Ethernet

new file

# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:0c:29:d3:48:0e
ONBOOT=yes
NETMASK=255.255.0.0
IPADDR=192.168.1.10
GATEWAY=192.168.1.100
TYPE=Ethernet

restart server :

 ifdown ech0

 ifup ech0  [same function : service network restart]

4.change hostname

hostname show host name

hostname hadoop --change one time

permenet change :

change file /etc/sysconfig/network

[root@localhost sysconfig]# cat network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=hadoop

5.ip bind with hostname

vi /etc/hosts

add a line :192.168.1.10  hadoop

6.close firewall

6.1.server iptable status

  [root@hadoop etc]# service iptables status Table: filter Chain INPUT (policy ACCEPT) num  target     prot opt source               destination         1    RH-              Firewall-1-INPUT  all  --  0.0.0.0/0            0.0.0.0/0          

  Chain FORWARD (policy ACCEPT) num  target     prot opt source               destination         1    RH-Firewall-1-INPUT  all  --  0.0.0.0/0              

      0.0.0.0/0          

     Chain OUTPUT (policy ACCEPT) num  target     prot opt source               destination        

6.2 service iptables start/stop

     iptables {start|stop|restart|condrestart|status|panic|save}

7.check firewall server is run or not

   7.1  grep iptables server's status

    [root@hadoop etc]# chkconfig --list |grep iptables
      iptables        0:off   1:off   2:on    3:on    4:on    5:on    6:off

7.2 close all firewall's service  and check status

[root@hadoop etc]# chkconfig iptables off
[root@hadoop etc]# chkconfig --list |grep iptables
iptables        0:off   1:off   2:off   3:off   4:off   5:off   6:off
[root@hadoop etc]#


 

原文地址:https://www.cnblogs.com/fjsnail/p/4324904.html