Configuring the DHCP Server And log DHCP logs

3.2 hcitool scan for bluetooth devices

Before start scanning make sure that your bluetooth device is turned on
and not blocked, you can check that with the rfkill command:

sudo rfkill list

If the bluetooth device is blocked (soft or hard blocked), unblock it
with the rfkill command again:

sudo rfkill unblock bluetooth

Bring up the bluetooth device with hciconfig command and start scanning,
make sure the target device’s bluetooth is on and It’s discoverable:

sudo hciconfig hci0 up
hcitool scan

Wait few moment to complete the hcitool scan or hcitool lescan, the
results will be something like bellow:

365娱乐场体育投注 1

365娱乐场体育投注 2

Here 00:1A:7D:DA:71:0A is the bluetooth MAC address and SHEN-PC is the
name of the bluetooth device, i.e. an PC.

note: use hcitool lescan will forever scan ble devices, if use
ctrl+c stop it, it will show error(ref to LINKS
4
to solve):

hcitool lescan
Set scan parameters failed: Input/output error

 

Temporary Solution

You can temporarily add a route to 255.255.255.255 using the route add
command as seen below.

[root@bigboy tmp]# route add -host 255.255.255.255 dev eth0

If you want this routing state to be maintained after a reboot, then use
the permanent solution that’s discussed next.

2.Change the root password

If you want to change it, press Y. Otherwise, press N.

365娱乐场体育投注 3

Fig.06: MySQL security

3.3 bluetooth service discovery

Now we have the bluetooth MAC address of the target device, use the
sdptool command to know which services (like DUN, Handsfree audio) are
available on that target device.

sdptool browse 28:ED:6A:A0:26:B7

You can also use the interactive bluetoothctl tool for this purpose.

If the target device is present, you can ping it with l2ping command,
requires root privilege:

➜  bluez-5.50  sudo l2ping 94:87:E0:B3:AC:6F
Ping: 94:87:E0:B3:AC:6F from B8:27:EB:8E:CC:51 (data size 44) ...
44 bytes from 94:87:E0:B3:AC:6F id 0 time 53.94ms
44 bytes from 94:87:E0:B3:AC:6F id 1 time 77.12ms
44 bytes from 94:87:E0:B3:AC:6F id 2 time 38.63ms
44 bytes from 94:87:E0:B3:AC:6F id 3 time 46.13ms
44 bytes from 94:87:E0:B3:AC:6F id 4 time 59.96ms
5 sent, 5 received, 0% loss

So, bluetooth service discovery is useful to determine the type of the
device, like if it’s a bluetooth mp3 player or it’s a keyboard.

365娱乐场体育投注 4

 

Routing

When a DHCP configured PC boots, it requests its IP address from the
DHCP server. It does this by sending a standardized DHCP broadcast
request packet to the DHCP server with a source IP address of
255.255.255.255.

If your DHCP server has more than one interface, you have to add a route
for this 255.255.255.255 address so that it knows the interface on which
to send the reply; if not, it sends it to the default gateway. (In both
of the next two examples, we assume that DHCP requests will be coming in
on interface eth0).

Note: More information on adding Linux routes and routing may be
found in Chapter 3, “Linux
Networking”.

Note: You can’t run your DHCP sever on multiple interfaces because
you can only have one route to network 255.255.255.255. If you try to do
it, you’ll discover that DHCP serving working on only one interface.

Install LEMP (Linux, Nginx, MySQL and PHP) Stack on Ubuntu Linux 14.04 LTS

by
VIVEK
GITE on
DECEMBER 2, 2014

365娱乐场体育投注 5

I’m
a new Ubuntu Linux user. How do I install the LEMP stack on an Ubuntu
Linux 14.04 LTS server using command line options to serve dynamic web
apps?

As one of the most popular Linux distribution in the world, Ubuntu has
released the latest version on April 17, 2014. The latest version is
14.04 with code name Trusty Tahr. Ubunt 14.04 is a LTS (Long Term
Support) version. This means that Ubuntu 14.04 will be supported for the
next 5 years from the release date. In this tutorial we will cover
Nginx, MySQL and PHP installation on Ubuntu Linux v14.04.

Tutorial details
Difficulty Easy (rss)
Root privileges Yes
Requirements Ubuntu
Estimated completion time 15m

3. How to use the bluez and hcitool

2、Download Nordic nRF5x SDK

DHCP Clients Obtaining 169.254.0.0 Addresses

Whenever Microsoft DHCP clients are unable to contact their DHCP server
they default to selecting their own IP address from the 169.254.0.0
network until the DHCP server becomes available again. This is
frequently referred to as Automatic Private IP Addressing (APIPA). Here
are some steps you can go through to resolve the problem:

  • Ensure that your DHCP server is configured correctly and use the
    pgrep command discussed earlier to make sure the DHCP process is
    running. Pay special attention to your 255.255.255.255 route,
    especially if your DHCP server has multiple interfaces.
  • Give your DHCP client a static IP address from the same range that
    the DHCP server is supposed to provide. See whether you can ping the
    DHCP server. If you cannot, double-check your cabling and your NIC
    cards.
  • DHCP uses the BOOTP protocol for its communication between the
    client and server. Make sure there are no firewalls blocking this
    traffic. DHCP servers expect requests on UDP port 67 and the DHCP
    clients expect responses on UDP port 68. Use tcpdump on the
    server’s NIC to verify the correct traffic flows.

3.Remove anonymous user

It is recommended to remove anonymous user to mitigate risk who can log
in into your database.

365娱乐场体育投注 6

Fig.07: MySQL security

LINKS

  • 1.Bluetooth on Modern Linux by Szymon
    Janc
  • 2.dbus-python
    tutorial
  • 3.Linux bluetooth setup with bluez and
    hcitool
  • 4.hcitool lescan shows I/O
    error

365娱乐场体育投注 7

@beautifulzzzz
智能硬件、物联网,热爱技术,关注产品
博客:http://blog.beautifulzzzz.com
园友交流群:414948975
beautifulzzzz@lpc:~/Documents/nRF5_SDK_12.2.0_f012efa$ tree -L 2
.
├── components
│   ├── ant
│   ├── ble
│   ├── boards
│   ├── device
│   ├── drivers_ext
│   ├── drivers_nrf
│   ├── libraries
│   ├── nfc
│   ├── proprietary_rf
│   ├── sdk_validation.h
│   ├── serialization
│   ├── softdevice
│   └── toolchain
├── documentation
│   ├── index.html
│   ├── license.txt
│   ├── NordicS.jpg
│   ├── nRF5x_series_logo.png
│   └── release_notes.txt
├── examples
│   ├── ant
│   ├── ble_central
│   ├── ble_central_and_peripheral
│   ├── ble_peripheral
│   ├── crypto
│   ├── dfu
│   ├── dtm
│   ├── multiprotocol
│   ├── nfc
│   ├── peripheral
│   ├── proprietary_rf
│   └── readme.txt
├── external
│   ├── cifra_AES128-EAX
│   ├── fatfs
│   ├── freertos
│   ├── licenses_external.txt
│   ├── micro-ecc
│   ├── nano-pb
│   ├── nfc_adafruit_library
│   ├── nrf_cc310
│   ├── protothreads
│   ├── rtx
│   ├── segger_rtt
│   └── tiny-AES128
├── licenses.txt
├── nRF5x_MDK_8_11_1_IAR.msi
├── nRF5x_MDK_8_11_1_Keil4.msi
└── svd
    ├── nrf51.svd
    ├── nrf52840.svd
    └── nrf52.svd

Normally if you have a cable modem or DSL, you get your home PC’s IP
address dynamically assigned from your service provider. If you install
a home cable/DSL router between your modem and home network, your PC
will most likely get its IP address at boot time from the home router
instead. You can choose to disable the DHCP server feature on your home
router and set up a Linux box as the DHCP server.

6.Reload privilege tables

Then we need to reloading the privilege tables to ensure all changes
made so far will take effect immediately.

365娱乐场体育投注 8

Fig.10: MySQL security

365娱乐场体育投注 9

Setting the correct device is crucial, and the speed setting is needed
to make the programming fast enough. The softdevice is first programmed
in the beginning (location 0) and the application is programmed
immediately after (0x16000 for S110 v7.0). After the programming a reset
is needed (‘r’ + ‘g’).

Configuring Windows Clients to Use DHCP

Fortunately Windows defaults to using DHCP for all its NIC cards so you
don’t have to worry about doing any reconfiguration.

#3 – Configure MySQL

After the configuration section is done, now we need to test them to
make sure that our configuration is working as required. On Ubuntu 14.04
the root document folder is located in /usr/share/nginx/html. So create
a file called /usr/share/nginx/html/phpinfo.php with the following code:

[php] view
plaincopy

  1. <span
    style=”margin:0px;
    padding:0px; word-wrap:break-word; color:rgb(0,0,0)”><strong><?</strong></span>
    <a target=”_blank”
    href=””
    style=”margin:0px;
    padding:0px; word-wrap:break-word; color:rgb(128,128,128);
    text-decoration:none”><span
    style=”margin:0px;
    padding:0px; word-wrap:break-word; color:rgb(0,0,102)”>phpinfo</span></a><span
    style=”margin:0px;
    padding:0px; word-wrap:break-word;
    color:rgb(102,204,102)”>(</span><span
    style=”margin:0px;
    padding:0px; word-wrap:break-word;
    color:rgb(102,204,102)”>)</span>;
    <span style=”margin:0px;
    padding:0px; word-wrap:break-word; color:rgb(0,0,0)”><strong>?></strong></span>

After restarting PHP-FPM and Nginx, open the browser and browse to the
php file, we got only a blank screen. No error message on the screen. No
error message on PHP-FPM and Nginx log file.
365娱乐场体育投注 10
Then we changed /usr/share/nginx/html/phpinfo.php file code on the root
document of Nginx, as follows:

[bet36体育在线,php] view
plaincopy

  1. <span
    style=”margin:0px;
    padding:0px; word-wrap:break-word; color:rgb(0,0,0)”><strong><?php</strong></span>
    <a target=”_blank”
    href=””
    style=”margin:0px;
    padding:0px; word-wrap:break-word; color:rgb(128,128,128);
    text-decoration:none”><span
    style=”margin:0px;
    padding:0px; word-wrap:break-word; color:rgb(0,0,102)”>phpinfo</span></a><span
    style=”margin:0px;
    padding:0px; word-wrap:break-word;
    color:rgb(102,204,102)”>(</span><span
    style=”margin:0px;
    padding:0px; word-wrap:break-word;
    color:rgb(102,204,102)”>)</span>;
    <span style=”margin:0px;
    padding:0px; word-wrap:break-word; color:rgb(0,0,0)”><strong>?></strong></span>

And then open the browser again and type url

365娱乐场体育投注 11
It seem that by default, we can not use short php-tag like this:

[php] view
plaincopy

  1. <span
    style=”margin:0px;
    padding:0px; word-wrap:break-word; color:rgb(0,0,0)”><strong><?</strong></span>
    … your code … <span style=”margin:0px;
    padding:0px; word-wrap:break-word; color:rgb(0,0,0)”><strong>?></strong></span>

To enable short php tag, we need to change the value of short_365娱乐场体育投注,open_tag
parameter on php.ini file:
365娱乐场体育投注 12
Change the value from Off to On. Then restart your php5-fpm :
sudo service php5-fpm restart
Then try again to test your phpinfo file. Next, we will see if the MySQL
support is enabled or not. Scroll down the php configuration screen on
your browser, if you see MySQL block there, then MySQL support already
enabled.
365娱乐场体育投注 13
You are now ready to use Nginx, PHP5 and MySQL on Ubuntu server. I hope
this quick article help anyone who wish to install Linux, Nginx, PHP and
MySQL on Ubuntu 14.04.

星期日, 02. 九月 2018 11:58下午 – beautifulzzzz

Now plug the JLink device into the USB and then goto the
install-path(here is /dev/bus/JLink_Linux_V480h_x86_64), type
./JLinkExe command, you will see(as following screenshot) a Contex-M0
device was fond and the target interface speed is 100khz. If could not
find a device, please check whether the JLink device is inserted or the
JLink driver version is correct.

Managing the DHCP Server

Managing the DHCP daemon is easy to do, but the procedure differs
between Linux distributions. Here are some things to keep in mind.

  • Firstly, different Linux distributions use different daemon
    management systems. Each system has its own set of commands to do
    similar operations. The most commonly used daemon management systems
    are SysV and Systemd.
  • Secondly, the daemon name needs to be known. In this case the name
    of the daemon is dhcpd.

Armed with this information you can know how to:

  • Start your daemons automatically on booting
  • Stop, start and restart them later on during troubleshooting or when
    a configuration file change needs to be applied.

For more details on this, please take a look at the “Managing Daemons”
section of Chapter 6 “Installing Linux
Software”

Note: If you modify your daemon configuration file remember that the
changes won’t take effect till you restart the daemon.

Note: Remember to configure your daemon to start automatically upon
your next reboot.

PHP Installation For Server Side Scripting

Since PHP is popular, a lot of websites is built using PHP language. As
of January 2013, PHP was installed on more than 240 millions websites.
Now we are going to install PHP on Ubuntu 14.04

3.1 setup bluetooth service

Start the bluetooth service and enable automatic startup, assuming
you’re using systemd as the init daemon:

sudo systemctl start bluetooth.service
sudo systemctl enable bluetooth.service

Next I will write use MakeFile to achieve automating tasks~

dhcpd.conf File

You can define your server configuration parameters in the dhcpd.conf
file which may be located in the /etc the /etc/dhcpd or /etc/dhcp3
directories depending on your version of Linux.

Note: The skeleton dhcp.conf file that is created when you install
the package may vary in its completeness. In Ubuntu / Debian, the
skeleton dhcpd.conf file is extensive with most of the commands
deactivated with a # sign at the beginning. In Fedora / RedHat / CentOS
an extensive sample is also created with activated commands. It is found
in the following location which you can always use as a guide.

/usr/share/doc/dhcp*/dhcpd.conf.sample

Note: The dhcpd.conf configuration file formats in Debian / Ubuntu
and Redhat / Fedora are identical.

Here is a quick explanation of the dhcpd.conf file: Most importantly,
there must be a subnet section for each interface on your Linux box.

ddns-update-style interim
ignore client-updates

subnet 192.168.1.0 netmask 255.255.255.0 {

   # The range of IP addresses the server
   # will issue to DHCP enabled PC clients
   # booting up on the network

   range 192.168.1.201 192.168.1.220;

   # Set the amount of time in seconds that
   # a client may keep the IP address

  default-lease-time 86400;
  max-lease-time 86400;

   # Set the default gateway to be used by
   # the PC clients

   option routers 192.168.1.1;
   # Don't forward DHCP requests from this
   # NIC interface to any other NIC
   # interfaces

   option ip-forwarding off;

   # Set the broadcast address and subnet mask
   # to be used by the DHCP clients

  option broadcast-address 192.168.1.255;
  option subnet-mask 255.255.255.0;

   # Set the NTP server to be used by the
   # DHCP clients

  option ntp-servers 192.168.1.100;

   # Set the DNS server to be used by the
   # DHCP clients

  option domain-name-servers 192.168.1.100;

   # If you specify a WINS server for your Windows clients,
   # you need to include the following option in the dhcpd.conf file:

  option netbios-name-servers 192.168.1.100;

   # You can also assign specific IP addresses based on the clients'
   # ethernet MAC address as follows (Host's name is "laser-printer":

  host laser-printer {
      hardware ethernet 08:00:2b:4c:59:23;
     fixed-address 192.168.1.222;
   }
}
#
# List an unused interface here
#
subnet 192.168.2.0 netmask 255.255.255.0 {
}

There are many more options statements you can use to configure DHCP.
These include telling the DHCP clients where to go for services such as
finger and IRC. Check the dhcp-options man page after you do your
install:

[root@bigboy tmp]# man dhcp-options

Note: The host statement seen in the sample dhcpd.conf file can be
very useful. Some devices such as network printers default to getting
their IP addresses using DHCP, but users need to access them by a fixed
IP address to print their documents. This statement can be used to
always provide specific IP address to DHCP queries from a predefined a
NIC MAC address. This can help to reduce systems administration
overhead.

4.Disallow root login remotely

To make sure that no one remote your database as root from another
machines, we need to disallow root login remotely.

365娱乐场体育投注 14

Fig.08: MySQL security

2. Download And Install

I follow the blog (Installing Bluez 5.44 onto
Raspbian?)
to install bluez-5.50.

Download the most recent version from the official
page:.

For example, at the time of writing it was 5.50, so I used(on my pi):

wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.50.tar.xz

Then I extracted it and built it:

tar -xf bluez-5.50.tar.xz
cd bluez-5.50

Read the README! It lists the dependencies and the configure
switches:

Install the dependencies first: (glib, dbus, libdbus, udev, etc.)

sudo apt install libdbus-1-dev libudev-dev libical-dev libreadline-dev

note: If you do not install the libdbus-1-dev, you will later get
this strange error:

configure: error: D-Bus >= 1.6 is required

once you’ve installed dependencies, you can configure switches:

./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc --localstatedir=/var  --enable-experimental

then do:

make
sudo make install

It takes maybe 10 minutes to compile. After installing, you should find
bluetoothd in /usr/libexec/bluetooth. You should also see bluetoothd
in /usr/lib/bluetooth.

Go to each of these directories and type

./bluetoothd --version

You’ll note that the one in libexec is new and the one in lib is old.

In order to make sure that d-bus is talking to you new BlueZ 5.50
and not your old BlueZ 5.43, you need to tell systemd to use the new
bluetooth daemon:

sudo vim /lib/systemd/system/bluetooth.service

Make sure the exec.start line points to your new daemon in
/usr/libexec/bluetooth.

For me, that wasn’t enough. No matter what, upon restart I always got
bluetoothd 5.43… So I just created a symlink from the old one to the
new.

First rename the old file:

sudo mv /usr/lib/bluetooth/bluetoothd /usr/lib/bluetooth/bluetoothd-543.orig

Create the symlink:

sudo ln -s /usr/libexec/bluetooth/bluetoothd /usr/lib/bluetooth/bluetoothd
sudo systemctl daemon-reload

That should do it.

365娱乐场体育投注 15

1、Install gcc-arm-none-eabi

DHCP Servers with Multiple NICs

DHCP servers with multiple interfaces pose two configuration challenges.
The first is setting up the correct routing and the second is making
sure only the required interfaces are listening to serve DHCP. Don’t
worry, both will be discussed next.

#1 – Configure PHP5-FPM

PHP5-FPM configuration file is located at /etc/php5/fpm/php.ini. Open it
with your text editor
$ sudo vi /etc/php5/fpm/php.ini
Change this parameter, from:
cgi.fix_pathinfo=1
to:
cgi.fix_pathinfo=0
Save and close the file and then restart php5-fpm service, type:
$ sudo service php5-fpm restart

1. Introduction

Bluez is the default Bluetooth protocol stack on Linux. It should be
present and installed on your Linux distribution. If not, building and
installing from source is not too difficult:

  • Download the latest stable source release of Bluez from here. Unzip
    the compressed file you downloaded.
  • Install the headers and libraries required for Bluez compilation:

365娱乐场体育投注 16

/* Open Jlink Commander from terminal in _build directory */ 
JLinkExe  -device <nRF51/nRF52>
> erase // Optional: erase target if not already blank
> loadfile <name>.hex // loads FW
> r // Reset and halt
> g // Run
> q //  Exit

Using a Single DHCP Server to Serve Multiple Networks

As stated before, DHCP clients send their requests for IP addresses to a
broadcast address which is limited to the local LAN. This would imply
that a DHCP server is required on each subnet. Not so. It is possible to
configure routers to forward DHCP requests to a DHCP server many hops
away. This is done by inserting the IP address of the router’s interface
on the DHCP client’s network into the forwarded packet. To the DHCP
server, the non-blank router IP address field takes precedence over the
broadcast address and it uses this value to provide a DHCP address that
is meaningful to the client. The DHCP server replies with a broadcast
packet, and the router, which has kept track of the initial forwarded
request, forwards it back towards the client. You can configure this
feature on Cisco devices by using the ip helper-address command on all
the interfaces on which DHCP clients reside. Here is a configuration
sample that points to a DHCP server with the IP address 192.168.36.25:

interface FastEthernet 2/1
  ip address 192.168.1.30 255.255.255.0
  ip helper-address 192.168.36.25

7.Done

365娱乐场体育投注 17

Fig.11: MySQL security

@beautifulzzzz
智能硬件、物联网,热爱技术,关注产品
博客:http://blog.beautifulzzzz.com
sina:http://weibo.com/beautifulzzzz?is_all=1

Listening

Once you have defined the interface for your DHCP routing you should
also ensure that your DHCP server only listens on that interface and no
others. This methodology to do this varies depending on your versión of
Linux.

Fedora / RedHat /
CentOS:
The /etc/sysconfig/dhcpd file must be edited and the
DHCPDARGS variable edited to include the preferred interface. In this
example interface eth0 is preferred.

# File: /etc/sysconfig/dhcpd
DHCPDARGS=eth1

Debian / Ubuntu:
The /etc/default/dhcp3-server file must be edited and the INTERFACES
variable edited to include the preferred interface. In this example
interface eth0 is preferred.

# File: /etc/default/dhcp3-server
INTERFACES="eth0"

You will be able to verify success in one of two ways. First the netstat
command using the –au options will give the list of interfaces listening
on the bootp (DHCP) UDP port.

[root@bigboy-f ~]# netstat -au  | grep bootp
udp        0     0 192.168.1.100:bootps    *:*
[root@bigboy-f ~]#

Secondly, your /var/log/messages file will also reveal the defined
interfaces used when the DHCPd daemon was restarted.

Jan  8 17:22:44 bigboy dhcpd: Listening on LPF/eth0/00:e0:18:5c:d8:41/192.168.1.0/24
Jan  8 17:22:44 bigboy dhcpd: Sending on   LPF/eth0/00:e0:18:5c:d8:41/192.168.1.0/24

Success! You can go back to lunch!

#1 – Download and install PHP

As usual, we can download and install PHP using apt-get command. Just
type the following command on your Ubuntu console or over the ssh based
session:
$ sudo apt-get install php5-fpm

365娱乐场体育投注 18

Fig.12: Install PHP for Server Side Processing on Ubuntu

And wait for the installation to complete.

4、Use Makefile To Bulid nRF51 Project

Configuring Linux Clients to Use DHCP

A Linux NIC interface can be configured to obtain its IP address using
DHCP with the examples outlined in , “Chapter 3, Linux
Networking”.
Please refer to this chapter if you need a quick refresher on how to
configure a Linux DHCP client.

#2 – Test Nginx

Once it get done, you can open your browser and type url
or to test it. If everything
goes normal, you will see Nginx welcome page:

365娱乐场体育投注 19

Fig.02: Welcome nginx page on Ubuntu Linux

365娱乐场体育投注 20

Permanent Solution

Create a permanent route to 255.255.255.255. This will vary according to
your version of Linux

Fedora / RedHat /
CentOS:
Add the route to your
/etc/sysconfig/network-scripts/route-eth0 file if the route needs to be
added to your eth0 interface.

#
# File /etc/sysconfig/network-scripts/route-eth0
#

255.255.255.255/32 dev eth0

Ubuntu / Debian:
Add the route to your /etc/network/interfaces file. In this case the
route is added to the eth0 interface.

#
# File: /etc/network/interfaces
#

iface eth0 inet static

       up route add -host 255.255.255.255 eth0

Simple Linux routing is covered in Chapter 3, “Linux
Networking”
and will add more clarity to adding permanent static routes.

#3 – Securing access to MySQL

If we are going to use MySQL as a production database, we may want to
secure it. MySQL provides a shell script to help us securing it. Just
type the following command on your console:
$ sudo mysql_secure_installation
Here are the steps to do it.

发表评论

电子邮件地址不会被公开。 必填项已用*标注