2015/06/21

在 CENTOS 7 的版本可以使用 hostnamectl 來改變系統 hostname

在 CENTOS 7 的版本可以使用 hostnamectl 來改變系統 hostname
---------------------------
#  hostnamectl 指令用法
[root@dc216979 ~]# hostnamectl --help
hostnamectl [OPTIONS...] COMMAND ...

Query or change system hostname.

  -h --help              Show this help
     --version           Show package version
     --transient         Only set transient hostname
     --static            Only set static hostname
     --pretty            Only set pretty hostname
  -P --privileged        Acquire privileges before execution
     --no-ask-password   Do not prompt for password
  -H --host=[USER@]HOST  Operate on remote host

Commands:
  status                 Show current hostname settings
  set-hostname NAME      Set system hostname
  set-icon-name NAME     Set icon name for host
  set-chassis NAME       Set chassis type for host

# 顯示目前狀態
[root@dc216979 ~]# hostnamectl status
   Static hostname: test.jangmt.com
         Icon name: computer
           Chassis: n/a
        Machine ID: 58ab28939f7f4b849244b1d618da079f
           Boot ID: 4820af9d14a043d8ba6392196fbf7508
    Virtualization: oracle
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-229.4.2.el7.x86_64
      Architecture: x86_64

# 修改主機名稱
[root@dc216979 ~]# hostnamectl set-hostname datanode.jangmt.com

# 顯示目前狀態
[root@dc216979 ~]# hostnamectl status
   Static hostname: datanode.jangmt.com
         Icon name: computer
           Chassis: n/a
        Machine ID: 58ab28939f7f4b849244b1d618da079f
           Boot ID: 4820af9d14a043d8ba6392196fbf7508
    Virtualization: oracle
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-229.4.2.el7.x86_64
      Architecture: x86_64

重開機後,就會正常了。



REF:
http://www.itzgeek.com/how-tos/linux/centos-how-tos/change-default-runlevel-in-centos-7-rhel-7.html 

2015/06/17

pptpsetup 文字客戶端設定 in CentOS 6


pptpsetup 文字客戶端設定 in CentOS 6

mint-HP-ProBook-4530s shell # pptpsetup --create ppp0 --server ooo.xxx.xxx.ooo --username mtxxx --password 1234xxx --encrypt --start
Connect: ppp0 <--> /dev/pts/5
CHAP authentication succeeded
MPPE 128-bit stateless compression enabled
local  IP address 172.16.15.100
remote IP address 172.16.15.254

mint-HP-ProBook-4530s shell # ifconfig ppp0
ppp0      Link encap:Point-to-Point Protocol  
          inet addr:172.16.15.100  P-t-P:172.16.15.254  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1496  Metric:1
          RX packets:5 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3 
          RX bytes:62 (62.0 B)  TX bytes:68 (68.0 B)

# 但是 default route 不對,預設只能內部連線,如果要透過這個 ip 對外有困難。

# 將預設的default 刪除,加入新的 ppp0
mint-HP-ProBook-4530s ppp # route del default
mint-HP-ProBook-4530s ppp # route add default dev ppp0
mint-HP-ProBook-4530s ppp # route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         0.0.0.0         0.0.0.0         U     0      0        0 ppp0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth0
172.16.15.254   0.0.0.0         255.255.255.255 UH    0      0        0 ppp0
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
172.24.10.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.123.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0


上 myip 網站看看自己對外的 ip
https://www.whatismyip.com/