菜单

Configuring the DHCP Server And log DHCP logs

2019年3月2日 - www6165com

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

 

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.

#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

澳门金沙国际 1

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

And wait for the installation to complete.

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:

澳门金沙国际 2

澳门金沙国际 3

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

2、Download Nordic nRF5x SDK

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.

Armed with this information you can know how to:

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.

#1 – Install MySQL and PHP support

Type the following command:
$ sudo apt-get install mysql-server php5-mysql

澳门金沙国际 4

Fig.03: Ubuntu Linux Install MySQL to Manage Site Data with PHP

During the installation, MySQL will ask you to enter MySQL root
password, other wise the installation will not continue. Type the
password you want, then press OK to continue the installation.

LINKS

澳门金沙国际 5

@beautifulzzzz
智能硬件、物联网,热爱技术,关注产品
博客:http://blog.beautifulzzzz.com
园友交流群:414948975

 

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 – Test MySQL

Once mysql installation finished, we can test it. Open your console and
type the following command:
$ mysql -u root -p

澳门金沙国际 6

Fig.04: Ubuntu test Mysql installation

If you type your password correctly, the you will see the mysql prompt.

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

Correct values for my current setup(my arm-none-eabi-gcc install in
/usr/bin):

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:

7.Done

澳门金沙国际 7

Fig.11: MySQL security

3. How to use the bluez and hcitool

Now you can use some JLink commands to erase、load、run、quit…

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 – 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

澳门金沙国际 8

Download the least nRF5x SDK
from  (the same to the
arm-none-eabi-gcc, you can chose the XunLei to download) ,and then
extract it in SDK-DIR(as you wish). The following shows the composition
of SDK:

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.

Configure Nginx to work with PHP and MySQL Server on Ubuntu

Now we have all components installed. The next step is we need to
configure Nginx with PHP and MySQL. Let’s start to configure them.

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.

澳门金沙国际 9

澳门金沙国际 10

Conclusion

In most home-based networks, a DHCP server isn’t necessary because the
DSL router / firewall usually has DHCP capabilities, but it is an
interesting project to try. Just remember to make sure that the range of
IP addresses issued by all DHCP servers on a network doesn’t overlap
because it could possibly cause unexpected errors. You might want to
disable the router/firewall’s DHCP server capabilities to experiment
with your new Linux server.

A DHCP server may be invaluable in an office environment where the time
and cost of getting a network engineer to get the work done may make it
simpler for Linux systems administrators to do it by themselves.

Creating a Linux DHCP server is straightforward and touches all the
major themes in the previous chapters. Now it’s time to try something
harder, but before we do, we’ll do a quick refresher on how to create
the Linux users who’ll be using many of the applications outlined in the
rest of the book.


How to log dhcp logs 

Hello All,
How can I configure isc-dhcp-server to 
1. Not send log info to /var/log/syslog
2. Reduce the amount of info in the log file.

In /etc/dhcp/dhcpd.conf  I have 
log-facility local7;

In /etc/rsyslog.conf I have
local7.*                        /var/log/dhcpd.log

With this config  I see dhcp activity in both /var/log/syslog
and /var/log/dhcpd.log

Thanks
//Ger

Need to restart both rsyslog and dhcp server:

    sudo service rsyslog stop
    sudo service rsyslog start
    sudo /etc/init.d/isc-dhcp-server restart


How to not log logs to syslog
file?

 

Hello,

I have setup the ISC dhcp daemon (v3.0.4) on an Ubuntu Feisty server.

In my dhcpd.conf file I have setup logging to a separate file with the line:

log-facility local0;

I have setup syslog to log local0 to a file /var/log/dhcpd.

This is all working a treat – log entries are being written to /var/log/dhcpd.

The problem is that everything is *also* being logged to /var/log/syslog. I’m getting everything logged twice.

Can anyone tell me how to stop dhcpd logging to both places? I only want it to log to local0 and thus my /var/log/dhcpd file.

Thanks!

H.

 

 

07-05-2007, 11:18 AM   #2
blackhole54
Senior Member
 

Registered: Mar 2006
Posts: 1,896

Rep:
 
You need to make another change to your /etc/syslog.conf file. My edgy eft system has the line

Code:
*.*;auth,authpriv.none          -/var/log/syslog

in it. I believe changing it to

Code:
*.*;auth,authpriv.none;local0.none          -/var/log/syslog

would solve your problem. Check the syslog.conf man page for more info, or in case I screwed it up.

#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:

澳门金沙国际 11

Fig.02: Welcome nginx page on Ubuntu Linux

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.

澳门金沙国际 12

<SDK>/components/toolchain/gcc

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.

What is new in Ubuntu 14.04 (Trusty Tahr) version?

You may see it on
cyberciti.biz
or visit the Ubuntu home page at ubuntu.com.

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:

澳门金沙国际 13

beautifulzzzz@lpc:~$ arm-none-eabi-gcc --version
The program 'arm-none-eabi-gcc' is currently not installed. You can install it by typing:
sudo apt install gcc-arm-none-eabi
beautifulzzzz@lpc:~$ sudo apt install gcc-arm-none-eabi

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.

#2 – Configure Nginx

Nginx configuration file is located at /etc/nginx/nginx.conf. But
basically, we don’t need to touch it. The configuration of nginx website
is located in /etc/nginx/sites-available/default file.
Open it, and uncomment lines:

 location ~ \.php$ {
         fastcgi_split_path_info ^(.+\.php)(/.+)$;
 #       # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
 #
 #       # With php5-cgi alone:
 #        fastcgi_pass 127.0.0.1:9000;
 #       # With php5-fpm:
         fastcgi_pass unix:/var/run/php5-fpm.sock;
         fastcgi_index index.php;
         include fastcgi_params;
 }

Then restart the services.
$ sudo service nginx restart
Please make sure, on Ubuntu 14.04, we cannot use fastcgi_pass
127.0.0.1:9000. So make sure that the line is commented. Otherwise, on
my machine, I got this error :
$ tail /var/log/nginx/error.log 2014/11/04 16:57:04 [emerg] 3216#0: "fastcgi_pass" directive is not allowed here in /etc/nginx/sites-enabled/default:59 2014/11/04 16:58:21 [emerg] 3256#0: "fastcgi_pass" directive is not allowed here in /etc/nginx/sites-enabled/default:59
On Ubuntu 14.04, I use the following line:
fastcgi_pass unix:/var/run/php5-fpm.sock
When I restart the Nginx and I still got the following error message:
2014/11/04 17:02:05 [emerg] 3295#0: "fastcgi_pass" directive is not allowed here in /etc/nginx/sites-enabled/default:61 2014/11/04 17:04:58 [emerg] 3410#0: "fastcgi_pass" directive is not allowed here in /etc/nginx/sites-enabled/default:61
Please make sure that you already uncomment this line:
location ~ \.php$ {

Refer to the blog: [那么些化解]
ubuntu上安装JLink驱动遭受的坑及给后来者的提出,downloading
the corresponding version driver is ok. But I find that the older
version driver(older then 5.12) cna’t find!!!

Simple DHCP Troubleshooting

The most common problems with DHCP usually aren’t related to the server;
after the server is configured correctly there is no need to change any
settings and it therefore runs reliably. The problems usually occur at
the DHCP client’s end for a variety of reasons. The following sections
present simple troubleshooting steps that you can go through to ensure
that DHCP is working correctly on your network.

#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.
澳门金沙国际 14
Then we changed /usr/share/nginx/html/phpinfo.php file code on the root
document of Nginx, as follows:

[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

澳门金沙国际 15
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_open_tag
parameter on php.ini file:
澳门金沙国际 16
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.
澳门金沙国际 17
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.

Afer erase whole chip, loading the file into nRF51 is simple—— For
simplicity in this tutorial copy the softdevice (S110) .hex file to the
_build folder of the Heart Rate Monitor example. The programming is
performed from the _build folder:

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 – 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.

澳门金沙国际 18

This chapter covers only the configuration of a DHCP server that
provides IP addresses. The configuration of a Linux DHCP client that
gets its IP address from a DHCP server is covered in Chapter 3, “Linux
Networking”,
on Linux Networking.

5.Remove test database

Sometimes some MySQL installation will create a database named ëtestí
for testing purpose. We can remove it if we donít use it.

澳门金沙国际 19

Fig.09: MySQL security

相关文章

发表评论

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

网站地图xml地图