月度归档:2020年07月

Freepbx mysql升级后的问题

SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: ” for column asterisk.music.random at row 1
File:/var/www/html/admin/modules/music/Music.class.php:135

/etc/mysql/mariadb.conf.d/50-server.cnf

或者/etc/my.cnf.d/server.cnf

在[mysqld]下面


#增加一行 sql_mode=""

然后重启

REF. https://sourceforge.net/p/raspbx/discussion/bugreports/thread/529c2a2e35/

Raspberry Pi 4 LED blink warnings

树莓派recovery模式

今天买了8G版本的pi4

直接用了sd卡进行更新升级

结果EEPROM死活更新不了,就卡着了

所以就直接用sd卡更新

首先把sd卡格式化为FAT或者FAT32

然后

https://github.com/raspberrypi/rpi-eeprom/blob/master/releases.md

下载

解压把所有文件拷进sd卡

插上机器然后接电,见到绿灯不停闪,就可以把sd好下来,断电,换成已经做好镜像的sd卡再通电了。

救活

下面是英语版本。

Recovery Procedure

Extract the files from the rpi-boot-eeprom-recovery zip file into a temporary folder. These files will be recovery.bin, pieeprom.bin and README.txt.

Now put those 3 files directly on the root of your blank FAT32 formatted SD card. Your recovery card is now prepped and ready!

Before powering up your device make sure that all USB devices are removed. Even keyboards have been known to cause issues so make sure absolutely everything is unplugged!

Now insert the SD card into the Pi and connect the power.

If the bootloader recovery is successful the green activity light will start blinking rapidly continuously (forever). In this case you have successfully recovered your bootloader! You may now insert a normal fully imaged SD card and it will boot normally again.

If anything other than a continuous rapidly blinking green light happens the recovery was not successful.

If Recovery Doesn’t Work

  • There is a known (and strange) issue with Raspberry Pi 4’s and 32 GB SD cards where the Pi will abort the boot. If this might apply to you then read this post.
  • Make sure you created your SD card correctly. A common pitfall is using cards above 32 GB and formatting them with ex-FAT instead of regular FAT/FAT32.
  • Make sure *all* USB devices are unplugged from the Pi
  • Try a different SD card if you have one available. SD cards do go bad all the time. If there’s any doubt here check out my Raspberry Pi storage benchmarks page to see the highest performing SD cards (you definitely want an A1 rated one).
  • Check your power cord. Make sure you are using a high quality USB-C power cord that is compatible with the Pi. Even if it was working before I have had several old Pi power supplies that worked for years die on me. If there’s any doubt grab a known reliable one like the Canakit USB-C Raspberry Pi 4 Power Supply

If you’ve gone through all the steps and are positive it’s not one of the above “gotcha” issues then it’s time to go deeper. You need to observe your Pi’s exact behavior when you plug it in (what the lights are doing). Here is a table of different blink patterns and what they mean:

Raspberry Pi 4 LED blink warnings
Raspberry Pi 4 LED blink warning table

If your Pi’s LED behavior matches any of these codes then we now have much more to go on to diagnose why your Pi won’t boot. Some of them are very obvious but they’re all worth a quick web search once you have matched it to a code.

If your Pi’s behavior does not match one of these codes head to the official sticky post on the Raspberry Pi forums and scroll to the very bottom (post #4 specifically for Raspberry Pi). This tracks ongoing boot issues with the Pi 4 that may affect your Pi and a whole bunch of things to try. If you get through that post go all the way up to post #1 and start going down the list.

REF https://jamesachambers.com/raspberry-pi-4-bootloader-firmware-updating-recovery-guide/

教你檢查Raspberry Pi 4的記憶體大小

想知道手邊的 Raspberry Pi 4的記憶體大小,可以在終端機中下指令查詢,也可以直接觀察硬體的差異。

Raspberry Pi 4 不同於以往,發行了三款記憶體大小不同的版本,來滿足不同客群的需求,想要知道手邊的Raspberry Pi 4的記憶體大小。除了可以在終端機中下指令查詢,也可以直接觀察硬體的差異。

本文大綱

  • 不同版本的Raspberry Pi 4硬體外觀差異
  • 查詢記憶體大小及使用量
  • 改變Swap交換空間大小

不同版本的Raspberry Pi 4硬體外觀差異

不同版本的黑色記憶體上會顯示不同文字

  • 1GB – 一個QRcode+文字
  • 2GB – 美光logo+文字 (重點文字差異:D9WHZ)
  • 4GB – 美光logo+文字 (重點文字差異:D9WHV)

查詢記憶體大小及使用量

打開Terminal輸入以下指令:

free -h

就可以看到有多少記憶體資源以及已經使用量。如下圖範例中,可用的資源為1.7GB,可以看出使用的Raspberry Pi 4是2GB記憶體版本。

Mem 那一列包含的資訊如下:

  • Total:開發板的記憶體量。
  • Used:記憶體總量減Free、Buffers、Cache的總和。
  • Free:未使用的記憶體量。
  • Shared:tmpfs文件系統使用的記憶體量。
  • Buff / cache:用於緩衝區和緩存的記憶體量。
  • Available:可用於處理來自應用程式和其他任何運行軟體的記憶體量估計。

Swap 那一列包含的資訊如下:

  • Total:交換分區或文件的大小,可以看到預設的大小為100MB。
  • Used:正在使用的交換空間量。
  • Free:未使用的交換空間量。

改變Swap交換空間大小

如果買的是1GB的樹梅派,有時候會覺得因為記憶體不足而有延遲或是當機。使用記憶卡的空間做swap交換空間雖然效能可能沒有實體記憶體好,但可以改善這個問題。

由於樹梅派原本預設已經配置100MB的swap,你可以參考以下步驟來增加swap交換空間的大小。

Step 1. 先暫停swap服務

在Terminal中輸入以下指令:

sudo dphys-swapfile swapoff

Step 2. 使用你喜愛的編輯器改變設定文件中的swap大小

在terminal中輸入以下指令,本範例中使用nano編輯器:

sudo nano /etc/dphys-swapfile

找到CONF_SWAPSIZE變數,原本為

CONF_SWAPSIZE=100

這裡的單位為MB,可以將此行註解掉,改成1024MB,也就是1GB的swap空間。

CONF_SWAPSIZE=1024

你也可以直接註解掉不要加新的設定,讓開發板自行計算適當的swap大小。

改好後記得存檔退出。

Step 3. 初始化 swapfile

sudo dphys-swapfile setup

Step 4. 重新啟動swap服務

sudo dphys-swapfile swapon

Step 5. 檢查swap狀態

可以同樣在Terminal中使用以下指令

free -h

再看一次資源分配的情況。

也可以使用以下指令僅看swap狀態

swapon -s
sudo systemctl enable dphys-swapfile.service

祝大家都可以順暢的使用樹梅派!

树莓派系统 设置IPv6地址模式为eui64

有三种解决方案(注意:通常三种里面只有一种有效)

#更改sysctl.conf里的内容
net.ipv6.conf.default.addr_gen_mode = 0
net.ipv6.conf.eth0.addr_gen_mode = 0
#更改dhcpcd.conf里的内容
slaac hwaddr
#从networkmanager中修改
sudo vim /etc/NetworkManager/system-connections/"你的连接名称"
addr-gen-mode=eui64


freepbx的mysql错误修复

An exception occurred while executing ‘ALTER TABLE outbound route email CHANGE emailfrom emailfrom VARCHAR(320) DEFAULT ”, CHANGE emailto emailto VARCHAR(320) DEFAULT ”, ADD PRIMARY KEY (route_id)’: SQLSTATE[42S02]: Base table or view not found: 1932 Table ‘asterisk.outbound_route_email‘ doesn’t exist in engine

在linux上查看mysql

#登陆mysql
mysql -u root -p
#输入密码
#1查看所有的数据库,不要忘了后面的分号
show databases;
进入要管理的相应的数据库
use asterisk;
#查看所有的表
show tables;
#查看相应表内的内容
desc tablename;
#记住你需要导出的表的名称
#退出mysql
#下面是导出所有的
mysqldump -u root -p --all-databases > all-databases.sql
#导出其中一个数据,database_name换成在(1)查到的相应的
mysqldump -u root -p database_name > database_name.sql
#不是全部导出,导出其中几个
mysqldump -u root -p --databases db_name1 db_name2 ...  > multi_database.sql
#如果要导出asterisk下的callback这个表
mysqldump -uroot -p asterisk callback > callback.sql
#如果多个表,就在后面继续写
mysqldump -uroot -p -d asterisk callback outbound_route_email > createtab.sql

查看mysql数据库文件保存的位置

mysql> show global variables like "%datadir%";

相应数据库的表,会以表名命名,分别有两个文件pjsip.frm,pjsip.ibd

如果只有一个文件,说明这个表是不完整的。在导入的导出的时候都会报错。

导入表

#进入mysql
#进入数据库
source sql.sql
#正常就会导入进去
desc tablename;
#查看导入的表的内容是否正确。

CentOS 7 为firewalld添加开放端口及相关资料

1、运行、停止、禁用firewalld

启动:# systemctl start  firewalld

查看状态:# systemctl status firewalld 或者 firewall-cmd –state

停止:# systemctl disable firewalld

禁用:# systemctl stop firewalld

查看firewall是否运行,下面两个命令都可以

systemctl status firewalld.service
firewall-cmd --state

查看default zone和active zone

我们还没有做任何配置,default zone和active zone都应该是public

firewall-cmd --get-default-zone
firewall-cmd --get-active-zones

查看当前开了哪些端口

其实一个服务对应一个端口,每个服务对应/usr/lib/firewalld/services下面一个xml文件。

firewall-cmd --list-services

查看还有哪些服务可以打开

firewall-cmd --get-services

查看所有打开的端口: 

firewall-cmd --zone=public --list-ports

更新防火墙规则: 

firewall-cmd --reload

添加一个服务到firewalld

firewall-cmd --add-service=http //http换成想要开放的service

这样添加的service当前立刻生效,但系统下次启动就失效,可以测试使用。要永久开发一个service,加上 –permanent

firewall-cmd --permanent --add-service=http

如果要添加的端口并没有服务对应

就要新建一个服务,在/usr/lib/firewalld/services,随便拷贝一个xml文件到一个新名字,比如myservice.xml,把里面的

<?xml version="1.0" encoding="utf-8"?>

<service>
<short>Transmission-client</short>
<description>Transmission is a lightweight GTK+ BitTorrent client.</description>
<port protocol="tcp" port="51413"/>
</service>

short改为想要名字(这个名字只是为了人来阅读,没有实际影响。重要的是修改 protocol和port。修改完保存。我的经验是这是要重启firewalld服务,systemctl restart firewalld.service,否则可能提示找不到刚才新建的service。然后把新建的service添加到 firewalld

firewall-cmd --permanent --add-service=myservice

重启firewalld 生效

5分钟理解Centos7防火墙firewalld    http://www.cnblogs.com/stevenzeng/p/5152324.html  

————————————————————————————————————-

1、firewalld的基本使用

启动: systemctl start firewalld

查看状态: systemctl status firewalld 

停止: systemctl disable firewalld

禁用: systemctl stop firewalld 

2.systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。

启动一个服务:systemctl start firewalld.service

关闭一个服务:systemctl stop firewalld.service

重启一个服务:systemctl restart firewalld.service

显示一个服务的状态:systemctl status firewalld.service

在开机时启用一个服务:systemctl enable firewalld.service

在开机时禁用一个服务:systemctl disable firewalld.service

查看服务是否开机启动:systemctl is-enabled firewalld.service

查看已启动的服务列表:systemctl list-unit-files|grep enabled

查看启动失败的服务列表:systemctl –failed

3.配置firewalld-cmd

查看版本: firewall-cmd –version

查看帮助: firewall-cmd –help

显示状态: firewall-cmd –state

查看所有打开的端口: firewall-cmd –zone=public –list-ports

更新防火墙规则: firewall-cmd –reload

查看区域信息:  firewall-cmd –get-active-zones

查看指定接口所属区域: firewall-cmd –get-zone-of-interface=eth0

拒绝所有包:firewall-cmd –panic-on

取消拒绝状态: firewall-cmd –panic-off

查看是否拒绝: firewall-cmd –query-panic 

那怎么开启一个端口呢添加

firewall-cmd –zone=public –add-port=80/tcp –permanent    

(–permanent永久生效,没有此参数重启后失效)

重新载入

firewall-cmd –reload

查看

firewall-cmd –zone= public –query-port=80/tcp

删除

firewall-cmd –zone= public –remove-port=80/tcp –permanent

Linksys SPA3102 with FreePBX

 http://kceng123.blogspot.com/

SPA3102 with Freepbx setup (Singapore)

Purpose of the document

I was tasked to implement VOIP system in a small company with about 20 staff in Singapore and about 10 staff in India office.To understand how VOIP work, and how VOIP can communicate with Analog phone system, I have purchase the Linksys SPA3102 ATA (About Singapore S$90 From Sim Lim Mediapro), try to understand how everything can work together.I have tried to google for document how SPA3102 work in Singapore environment, but without success. I managed to find information on how to setup SPA3102 with Freepbx, but document was long and not very easy to read and follow. So I decided to write this document, hoping anyone like me, being task to setup VOIP, can follow and understand.

Purpose of the Lab setup

The purpose for this lab setup, is to install FreePBX, with few extension number, and I have a home analog line (PSTN line), and wanted any of the few extension number from softphone able to make a call out thru this analog line. Objective 2 is off course to allow incoming call from analog line, to go to an Interactive voice respond menu, and select the option, and forward the call to the selected extension or softphone.Rest of the FreePBX feature, is not in this lab scope, and you should be able to find a lot of information on asterisk feature.There are also a lot of document covering on SPA3102 to connect to SIP service provider (In Singapore, service provider like hoiio), this document will not cover those too.

Setup step (Summary)

1.    Setup the hardware (SPA3102)2.    Setup the FreePBX3.    Configure FreePBXa.    Setup Extension4.    Setup Softphone5.    Configure FreePBXa.    Setup SIP Trunkb.    Setup Outbound Routec.     Setup Inbound Route6.    Configure SPA3102 to link to FreePBX

Hardware Setup

I assume that you have some network setup knowledge, setup the hardware as below.
1.    Once above is setup, power on the SPA3102 device2.    Using the analogue phone, press “****”, and after the greeting message press 110# to retrieve the Internet/WAN IP address. Take a note of this IP  Address.3.    Press “7932#” and then press “1#” to enable the HTTP Configuration over the WAN port. Now, press “1″ to save.4.    Now point your browser to the gateway device’s configuration page: “http://x.x.x.x”, where “x.x.x.x” is the IP Address assigned to the device by the DHCP Server.5.    Once the page loads click on the “Admin Login” link on the top right hand side of the page. This will provide the basic administration configuration version of the interface.6.    Now click on the “advanced” link on the top right hand side of the page. This will provide the advanced administration configuration version of the interface.7.    If you are able to access to the above, put the hardware one side, and setup the FreePBX. Above instruction extracted from http://www.3cx.com/voip-gateways/linksys-spa3102/Above picture extracted from http://hacsatel.hu/termek/cisco-spa3102-eu-single-port-router-with-1-phone-port-and-1-fxo-port–europe-/

FreePBX setup

1.    Create a virtual machine for the environment.2.    Download the FreePBX from http://www.freepbx.org/freepbx-distro3.    Follow the step by step installation
4.    Use the browser to point to the IP address, example above http://172.16.138.1055.    If you are able to access to the page, setup the extension number.

Extension Number setup in FreePBX

1.    Go to Application, click on Extensions
2.    Select “Generic SIP Device” and click “Submit”
3.    Select “Generic SIP Device” and click “Submit”
4.    Full in only the important fieldsa.    User Extensionb.    Display Namec.     Secret  (Password)5.    Click on Submit.
6.    Click on “Apply Config” on the top.7.    Repeat above to create a few more extension number.8.    Next ready to use the extension using the softphone.

Install Softphone (one on PC, and one on Smartphone)

1.    On the windows OS, install x-lite2.    Configure the xlite account
3.    Key in the Account Name (what key in FreePBX)4.    Key in the User ID (Extension Number in FreePBX)5.    Key in the IP address of the FreeBPX server6.    Key in the Password (Secret in FreePBX)7.    Click on “OK”8.    Install another xLite on another PC, or install Zoiper on Smartphone (Android)9.    If you are setting up Zoiper for another extension, the setting are similar, Account Name, Host, Username (Extension in FreePBX) and password (Secret in FreePBX).10.  Test to call from one extension to another extension, and see the call get thru.11.  If the call go thru, you are ready for the next step.

Configure FreePBX – SIP Trunk (for SPA3102 Analog Line Connection)

Extract from http://www.freepbx.org/support/documentation/howtos/howto-linksys-spa-3102-sipura-spa-3000-freepbx 1.    Create a new SIP trunk in FreePBX.
2.    Go to Connectivity and click on Trunks
3.    For Caller ID put my inbound DID From Singtel POTS line. 4.    Max channels, put 1 since it’s only one line. This is important because if you don’t do this, and this trunk is busy, calls may not fall through properly to the next trunk. 5.   Trunk name: Call this 1-pstn6.
#Outgoing settings - Peer settings as below
disallow=all 
allow=ulaw 
canreinvite=no 
context=from-trunk 
dtmfmode=rfc2833 
host=dynamic 
incominglimit=1 
nat=never 
port=5061 
qualify=yes 
secret=password 
type=friend 
username=1-pstn
7.    Click on “Submit Changes” 8.    Click on “Apply Config” on top

Configure FreePBX – Outgoing Route (for all extension to call out thru analog line)

Extract from http://www.freepbx.org/support/documentation/howtos/howto-linksys-spa-3102-sipura-spa-3000-freepbx 1.    Create a new Outbound Routes
2.    Name of the route : Spa30003.    No password for the route4.    The important setting here is the Dial Patterns. I have only configured to dial 9, to call an external number. Example, on the softphone dial 991231234, will put a call to PSTN line “91231234”. If you dial normal extension number, it will still go to extension number.
5.    Set the Trunk Sequence 0 to use “1-pstn” 6.    Click on the “Submit” 7.    Click on the “Apply Change” on top.

Configure FreePBX – Incoming Route (for incoming call from analog line to go to one fixed extension)

Extract from http://www.freepbx.org/support/documentation/howtos/howto-linksys-spa-3102-sipura-spa-3000-freepbx 1.    Create a new inbound Route
2.    Name of the route setup as “1-pstn”3.    DID number set to the DID number, this number must EXACTLY match the number you put in “Dial Plan 2” in SPA3102 PSTN Line setting
4.    Set Destination as extension number to go to, or setup as IVR.5.    Submit Changes and remember to click the “Apply Change” for the update.

Configure SPA3102 to link to FreePBX

1.    Browse to the SPA2102 admin page, and go to advance setting

SIP Tab

2.    Before you do anything else, go to the SIP tab. Look under RTP Parameters and check the RTP Packet Size. Linksys has set this to 0.030 by default, which is not correct for use on ulaw (G711u codec) connections. Change it to 0.020 instead (or 0.02 on older Sipura devices). If you don’t do this, you may experience strange problems with “choppiness” or random clicks on some calls but not others, and you may also experience problems when playing Asterisk sound files.3.    Next go to PSTN Tab

PSTN Tab

Proxy and Registration

1.    Line enable set to Yes. 2.    SIP Port is set to port 5061 (same as FreePBX port number in the trunk setup) 3.    Proxy set to the FreePBX IP address of your Asterisk box 4.    Make Call Without Reg: Yes5.    Ans Call Without Reg: Yes6.    Register Expires: 300

Subscriber Information

1.    Display name: Put something here that will identify this line – this is only displayed on your phones if you get a call with no Caller ID information (or you don’t subscribe to Caller ID). Keep it at 15 characters or shorter. You could use something like LOCAL PSTN CALL.2.    User ID: 1-pstn ; very important – this must exactly match the FreePBX Trunk name and username in the trunk configuration!3.    Password: XXXXXX (same as you used in FreePBX Trunk settings).

Audio Configuration

1.    DTMF Process INFO: Yes 2.    DTMF Process AVT: Yes 3.    DTMF Tx Method: Auto

Dial Plans

1.    Under Dial Plans it’s important not to change the default (xx.) on any except Dial Plan 2.2.    Dial Plan 2 set as  (S0<:1234567890>)3.    Replace 1234567890 with the telephone number of the PSTN line coming into the device. Note that this must exactly match the DID number in your FreePBX Inbound Route setting for this device. If the number here and in the Inbound Route don’t match exactly, you won’t receive incoming calls.

 

VoIP-To-PSTN Gateway Setup

This is another important settings section. 1.    VoIP-To-PSTN Gateway Enable: yes 2.    VoIP Caller Auth Method: None ; use “None” to start, you can change later for added security 3.    VoIP PIN Max Retry: 3 4.    One Stage Dialing: Yes ; very important 5.    Line 1 VoIP Caller DP: none 6.    VoIP Caller Default DP: none 7.    Line 1 Fallback DP: none

PSTN-To-VoIP Gateway Setup  

This is another important settings section. 1.    PSTN-To-VoIP Gateway Enable: Yes 2.    PSTN Caller Auth Method: none 3.    PSTN Ring Thru Line 1: no ; I use Asterisk for my routing. 4.    PSTN Pin Max Retry: 3 5.    PSTN CID for VoIP CID: Yes if you subscribe to CallerID service on your PSTN line, otherwise No 6.    PSTN CID Number Prefix: (Leave Blank) 7.    PSTN Caller Default DP: 2 ; important – here is where it sends the calls to. 8.    Off Hook While Calling VoIP: No 9.    Line 1 Signal Hook Flash To PSTN: Disabled 10.  PSTN CID Name Prefix: (Leave Blank) 11.  Leave everything else in this section blank.

FXO Timer Values (sec)  

1.    Voip Answer Delay: 0 (The original recommendation was 1, but this can cause a spurious half ring on outgoing calls, before actual ringing from the called line commences, so 0 is now the recommended value). 2.    PSTN Answer Delay: If you do not subscribe to CallerID service on your PSTN line, this can be set to 0. Most users will want to set it to at least 3 so that the incoming CallerID data is captured. In rare situations you may need a slightly longer delay (5 should be more than enough).

PSTN Disconnect Detection  

1.    For Singapore Singtel Phone line, please change Discount Tone to 425@-30,425@-30; 2(0.75/0.75/1+2)

International Control  

Check the settings here – each country uses different values for PSTN lines. If you live in Australia, Canada, the United States or most other countries with modern telephone systems you probably won’t have to change anything except perhaps the gain levels, so we’ll only deal with them for now. The default values for both the SPA To PSTN Gain and the PSTN To SPA Gain are 0 (zero), and that’s where you should leave them when you’re first setting up the SPA-3000/3102. But just so you know, here’s some information on those settings: 1.    If the SPA to PSTN gain is set too low, the parties on the PSTN side of the connection will probably complain about your volume being too low, or will ask you to speak up or talk closer to the phone. If it is set too high, however, you are more likely to hear echo, and outgoing calls may fail because the level of DTMF tones sent by the SPA-3000/3102 will be too “hot” to register properly at the PSTN switching equipment. 2.    If the PSTN To SPA Gain is set too low, you’ll hear low volume levels on PSTN calls. If it’s set too high, the people on the PSTN side of the connection will be more likely to hear echo (they may hear their own voices echoed back from your end). Also, any echo that has been reflected back to you will be heard at a higher volume level, and will therefore be more objectionable. 3.    While the default levels are usually adequate, we found that boosting both values up to 3 produced a more “natural” sounding volume level in both directions. However, this is very much dependent on the characteristics of the PSTN line – if you’re on a very short loop, values of 0 may be adequate for both settings, if on a very long loop you may need to go even higher than 3. The valid range is -15 dB to 12 dB in 1 dB increments (but just enter a numeric value, do not enter “dB” in the text field). If you have actual test equipment available you can fine-tune the volume settings for best results. 4.    I have not play with this number yet, but gain of zero is ok now.
Extract from http://www.freepbx.org/support/documentation/howtos/howto-linksys-spa-3102-sipura-spa-3000-freepbx

Test incoming and outgoing line

1.    Call you DID analog number, and check if it go to the extension or IVR.2.    From your softphone, call 9xxxxxxxx, and see if it call the external number.
https://www.stephenwagner.com/2012/03/02/configure-ciscolinksys-spa3102-for-trixbox-fxs-and-fxo/

Setting up IPv6 on AWS

Listen in the Operating System

Each Operating System has a slightly different network set up and will need a different configuration.

If you are unsure what Operating System you are running you can find out by reading this file:

cat /etc/*-release

I use vim below but you can use nano if you prefer we don’t mind. 🙂

Ubuntu 16 clients

  1. Connect into the server on the command line over IPv4 as the admin user.
  2. Find your Network Interface name
    • You can see all running network interfaces by running ifconfig, in most situations there should be two interfaces. lo is for local networking (where the traffic doesn’t leave the server) and there will be another which is what you are looking for.
    • You can also see your interfaces via the current configs: cat /etc/network/interfaces.d/50-cloud-init.cfg
    • My interface is eth0 but it will depend on your instance type what interface name you have.
  3. Create a new configuration file for IPv6.
    • sudo vim /etc/network/interfaces.d/60-auto-ipv6.cfg
    • And add the following line to your file and save.
      • iface eth0 inet6 dhcp
    • If you are interested in what this line does, it binds to the interface (for me eth0) using the inet6 (IPv6) address family and uses DHCP (Dynamic Host Configuration Protocol) to get the servers IP address.
  4. And last of all to load in this new config
    • sudo service networking restart
    • OR sudo ifdown eth0 && sudo ifup eth0 replacing “eth0” with your interface name.
A configured Ubuntu 16 server

Ubuntu 14 clients

You will need to reboot your Ubuntu 14 system to load in the new static IPv6 address.

  1. Connect into the server on the command line over IPv4 as the admin user.
  2. Find out your Network Interface name
    • You can see all running network interfaces by running ifconfig
    • My interface is eth0 but it will depend on your instance type what you have.
  3. Edit the existing network interface file.
    • vim /etc/network/interface.d/eth0.cfg
    • And make sure it contains the below lines
    auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp up dhclient -6 $IFACE
    • If you are interested in what these lines do, lines 1 and 2 set up a local loopback interface this guides traffic from the server to itself which sounds strange but is used often in networking.
    • Lines 3 and 4 starts networking on eth0 using DHCP (Dynamic Host Configuration Protocol) to get the servers IP address
    • Finally line 6 starts dhclient which handles DHCP with the -6 flag to get the IPv6 address.
  4. Reboot the server. sudo reboot

RedHat Enterprise Linux 7.4 and CentOS 7.4 clients

  1. Connect into the server on the command line over IPv4 as the admin user.
  2. On version 7.4 networking is managed by cloud-init. This is a standard tool for configuring cloud servers (like EC2 instances).
  3. Create a new config file in which we will enable ipv6 and add the below options.
  4. vim /etc/cloud/cloud.cfg.d/99-ipv6-networking.cfg
network:
        version: 1
        config:
        - type: physical
                name: eth0
                subnets:
                - type: dhcp6
A configured CentOS 7.4 server

RedHat Enterprise Linux 7.3 and CentOS 7.3 clients

  1. Connect into the server on the command line over IPv4 as the admin user.
  2. Edit the global network settings file
  3. vim /etc/sysconfig/network
    • Update the following line to match this. This will enable IPv6 for your system.
    • NETWORKING_IPV6=yes
  4. Edit the existing network interface file.
  5. vim /etc/sysconfig/network-scripts/ifcfg-eth0
    • Enable IPv6 for the interface
    • IPV6INIT=yes
    • Enable IPv6 DHCP so the server can automatically get its new IPv6 address
    • DHCPV6C=yes
    • Disable the Network Manager daemon so it doesn’t clash with AWS network services
    • NM_CONTROLLED=no
  6. sudo service network restart