add dhcp option in openwrt system - openwrt

I would like to add option 125 to the DHCP server (dnsmasq-2.85) into the OpenWrt OS.
I tried to in the /etc/config/dhcp file the following :
list dhcp_option_force '125,"Smart Hub 3A"'
list dhcp_option_force '125,"+105318+2033000160"'
list dhcp_option_force '125,"0000DB"'
but when getting the traffic of the DHCP server ACK doesn't contain the option 125.
how add this option in the dnsmasq OpenWrt package.

Related

Error code 80c6 occurs when tia portal connects to mosquitto broker [duplicate]

I have a virtual machine that is supposed to be the host, which can receive and send data. The first picture is the error that I'm getting on my main machine (from which I'm trying to send data from). The second picture is the mosquitto log on my virtual machine. Also I'm using the default config, which as far as I know can't cause these problems, at least from what I have seen from other examples. I have very little understanding on how all of this works, so any help is appreciated.
What I have tried on the host machine:
Disabling Windows defender
Adding firewall rules for "mosquitto.exe"
Installing mosquitto on a linux machine
Starting with the release of Mosquitto version 2.0.0 (you are running v2.0.2) the default config will only bind to localhost as a move to a more secure default posture.
If you want to be able to access the broker from other machines you will need to explicitly edit the config files to either add a new listener that binds to the external IP address (or 0.0.0.0) or add a bind entry for the default listener.
By default it will also only allow anonymous connections (without username/password) from localhost, to allow anonymous from remote add:
allow_anonymous true
More details can be found in the 2.0 release notes here
You have to run with
mosquitto -c mosquitto.conf
mosquitto.conf, which exists in the folder same with execution file exists (C:\Program Files\mosquitto etc.), have to include following line.
listener 1883 ip_address_of_the_machine(192.168.1.1 etc.)
By default, the Mosquitto broker will only accept connections from clients on the local machine (the server hosting the broker).
Therefore, a custom configuration needs to be used with your instance of Mosquitto in order to accept connections from remote clients.
On your Windows machine, run a text editor as administrator and paste the following text:
listener 1883
allow_anonymous true
This creates a listener on port 1883 and allows anonymous connections. By default the number of connections is infinite. Save the file to "C:\Program Files\Mosquitto" using a file name with the ".conf" extension such as "your_conf_file.conf".
Open a terminal window and navigate to the mosquitto directory. Run the following command:
mosquitto -v -c your_conf_file.conf
where
-c : specify the broker config file.
-v : verbose mode - enable all logging types. This overrides
any logging options given in the config file.
I found I had to add, not only bind_address ip_address but also had to set allow_anonymous true before devices could connect successfully to MQTT. Of course I understand that a better option would be to set user and password on each device. But that's a next step after everything actually works in the minimum configuration.
For those who use mosquitto with homebrew on Mac.
Adding these two lines to /opt/homebrew/Cellar/mosquitto/2.0.15/etc/mosquitto/mosquitto.conf fixed my issue.
allow_anonymous true
listener 1883
you can run it with the included 'no-auth' config file like so:
mosquitto -c /mosquitto-no-auth.conf
I had the same problem while running it inside docker container (generated with docker-compose).
In docker-compose.yml file this is done with:
command: mosquitto -c /mosquitto-no-auth.conf

Jenkins not accessible with http://<hostname>:8080 in Windows server 2012

I have installed Jenkins in Windows server 2012 64-bit machine and want to make it available in internal network.
I have added --httpListenAddress to 0.0.0.0 and restarted Jenkins and tried to access it with http://hostname:8080 but no page shows up(though It showing Jenkins icon in URL bar). However http://localhost:8080 works fine.
Further I checked the firewall inbound rule for the Jenkins but seems it has no issues.
I tried to catch the listening ports with "netstat -aon | find /i "8080" and found <host ip address>:8080 FIN_WAIT_2 which sign towards that the request is stuck(May be I am wrong).
I am clueless what exactly is blocking to use hostname with jenkins. Please share your solution if you already fixed this issue.
You might try adding a Windows Firewall rule. Go to Windows Firewall, Advanced Configuration, Inbound Rules rule and create an Allow rule for the specific version of java.exe you have installed.
This worked for us with the drawback that every time you upgrade Java, you must also modify the firewall rule. This is because Java creates a new subfolder for every version. We've tried using %JAVA_HOME% in firewall rules but it doesn't seem to work. We were on Windows Server 2012R2 at the time.
Similar answer here: https://stackoverflow.com/a/17479566/7752
On the server open a new command prompt and type
ipconfig
You should get a list of ips. Open a browser and type each up followed by 8080 for e.g.
http://202.123.2.1:8080
If Jenkins opens up, from another computer ping the ip and see if you can get a ping reply
ping 202.123.2.1
If you get a ping reply, you can access jenkins from any pc on the network by typing in the ip and port number.
Now to get to the hostname,you need to edit your host file
c:\Windows\System32\Drivers\etc\hosts
Type in the ip followed by the hostname
202.123.2.1 jenkins
If you can't get through, you need to open port 8080. See https://www.vultr.com/docs/how-to-open-a-port-in-windows-firewall-on-windows-server-2012
You cannot access from outside the machine because Jenkins Service does not have credentials to use that machine, only from localhost is accessible.
This is how to enter the credentials in Jenkins service.
In the Windows search bar, type services then enter.
Then scroll down to Jenkins and double-click on it.
In Jenkins Properties, select the tab "Log On".
Select Check box "This account"
Update your username and password.
Voila! Now Jenkins web can connect to the Jenkins machine via Jenkins service.

Even after installing jenkins as a windows service, i have to start it through command line before accessing it through browser

I have installed jenkins as windows service but every time after starting the machine i have to execute it through command line using $ java -jar jenkins.war
I am not able to directly open it into web browser at http://localhost:8080/
Am i missing something? Any help will be really appreciated.
Copy original 'jenkins.war' into 'jenkins' directory and restart service
Clear the Windows event viewer logs for Application and System
Please ensure your services are running and up
Firewall Issue:The easiest way to track down firewall issues is to use tcpdump. Just run the following command on the Jenkins server, which is trying to connect to the slave.
More Info on firewall part:
By default, Windows Firewall prevents the TCP connections necessary to make this mechanism work. The firewall on the slave must allow the following exceptions (see List of TCP&UDP port numbers):
TCP Port 135 (DCE/RPC Locator service)
TCP Port 139 (NetBIOS Session Service)
TCP Port 445 (Windows shares)
C:\WINDOWS\system32\dllhost.exe (dllhost.exe seems to use a random port number)
C:\WINDOWS\system32\javaw.exe (Jenkins also uses a random port number)
File and Printer sharing (TCP 139, TCP 445, UDP 137, UDP 138 (possibly only a subset of these is required))
The issue is fixed now. I have changed the service properties. In service properties -> Log On->Select Local system account and select the checkbox for allow the service to interact with desktop

How to connect openWrt (Virtualbox) to wifi?

I'm new user of openWRT I using a internet wifi in Ubuntu 16.04, I installed openWRT in VirtualBox, I tried to connect to internet but I failed, when I try to ping google.com I get this message **bad address google.com **
Just went through the same issue this morning. You have a good documentation in OpenWrt wiki for configuring your OpenWrt network when running over VirtualBox. The information below is all taken from the wiki, but I can assure that is working for a Barrier Breaker running on top of Ubuntu 16.04. The process is as follows:
With your VM off, open the VirtualBox Network tab and make the following configurations:
Configure Adapter 1 to use NAT
Configure Adapter 2 to use Bridge Adapter + Select your host machine's interface from the menu (the one that appears by using
commands as iwconfig or ifconfig). + disable promiscuous
mode
These configurations refer to the following screens (my wireless interface has the name wlx0022.., yours may be different):
Power on your VM and edit /etc/config/network. Change the two interfaces that the wiki mentions (wan and lan) and put them as it is shown below. Your interfaces may have different names before the change (in my case, the wan interface was wan6).
Your /etc/config/network file should look like this:
config 'interface' 'wan'
option 'proto' 'dhcp'
option 'ifname' 'eth0'
config 'interface' 'lan'
#option type 'bridge'
option ifname 'eth1'
#option ip6assign '60'
Just do the changes you need to in order to have your /etc/config/network file as it is shown above, but leaving the other interfaces in the file unchanged (as they are).
Then reboot OpenWrt. After that I was able to connect and ping to any site.
First,change your network connection in VirtualBox to Bridge Mode
Settings --> Network --> Adapter 1 --> Attached to --> Bridged Adapter
Second,modify /etc/config/network in OpenWRT
config interface lan
option ifname eth0
option type bridge
option proto dhcp
Restart your network by this command :
/etc/init.d/network restart
Note: make sure your host (Ubuntu 16.04) is connected to DHCP server.Then your OpenWRT-VirtualBox should get the IP address from it.
If you want to connect WiFi manually by editing file,
you need to edit mainly 3 files.
/etc/config/network
/etc/config/wireless
/etc/config/firewall
--> I would suggest adding the following portion in your network config file(/etc/config/network).
(make sure you do not have any assigned section for the wifi in the network config file)
config interface 'wifi'
option proto 'dhcp'
--> Also, you need to update the file (/etc/config/wireless)
config wifi-iface 'station1'
option device 'radio0'
option ifname 'wlan0'
option mode 'sta'
option network 'wifi'
option disabled '0'
option ssid 'name_of_the_wifi'
option key 'password_of_the_wifi'
option encryption 'encryption_of_wifi_generally_psk2'
in above setup option network 'wifi' "wifi" will be the name of the interface you defines in the /etc/config/network.[make sure if you have above section you edit the existing one. Do not add new section if you do not know what you are doing]
Here, replace "wlan0" with your wireless interface.
If you already have above section in wireless file,
you can also use uci commands as following,
uci set wireless.station1.ssid=name_of_wifi
uci set wireless.station1.key=password
uci set wireless.station1.encryption=psk2
uci commit wireless
wifi down; wifi
here, "station1" would be the name of the section.
--> In the /etc/config/firewall, find the option zone section where all the interface is defined, which looks like following
config zone
option name wan
list network 'wan'
list network 'wan6'
option input REJECT
option output ACCEPT
option forward REJECT
option masq 0
option mtu_fix 1
option conntrack 1
and add
list network 'wwan'
Command to check Wifi Connectivity: iwconfig
Refer the following link:
https://wiki.openwrt.org/doc/uci/wireless
NOTE: PLEASE READ FROM OPENWRT FORUM OR GOOGLE BEFORE DOING ANYTHING
The Wrong configuration may break the OpenWRT connection

Arduino with mosquitto mqtt

When I ran the Mosquitto (MQTT) broker for the first time there was no issue. However when running it for the second time using the default config I could not run the code successfully because of the following error on Windows 8:
1379497253: mosquitto version 1.2 (build date 2013-09-17 17:59:39+0530) starting 1379497253: Using default config. 1379497253: Opening ipv6 listen socket on port 1883. 1379497253: Error: Address already in use
How can I resolve this error, or more importantly what does this error mean?
Address already in use usually means that the port (in your case 1883) is already being used by another process. The most likely situation given your description is that another copy of mosquitto is already running. If you want to run two (or more) you'll need to configure each to use a separate port number.
You have to check the mosquitto.conf in a bin folder in which you installed the mosquitto server.
Make sure all lines are commented with '#' especially the following line,
port 1883 or listener 1883.
then, find some available port or whether the port 1883 is used by using command like netstat.
In windows, you can use this,
netstat -an| findStr 1883
You have to change your default port on mosquitto when found any message from the prompt.
Append some specific number on the line below which is indicating the port whatever you prefer to.
listener XXX
protocol mqtt

Resources