This post shows how to install ns 3.34 in Ubuntu 20.04 LTS
- Fresh installation of Ubuntu Version 20.04 LTS
- ns3.34 can be downloaded from here
![]() |
| ns-3.34 in Ubuntu 20.04 |



![]() |
| ns-3.34 in Ubuntu 20.04 |
To use the cloud broker (mqtt://broker.hivemq.com) and connect the publisher and subscriber with a topic and a message. To install the Hive MQ software in your local machine (127.0.0.1) and run the same above code locally and make the connectivity between the pub-sub.
![]() |
| MQTT using Node JS |
Using cloud broker:
Pub.js:
const mqtt = require("mqtt");
var client = mqtt.connect("mqtt://broker.hivemq.com");
client.on("connect",function()
{
setInterval(function(){
var random = Math.random()*50;
console.log(random);
if(random<30)
{
client.publish("Pradeep","temperature value: "+random.toString());
}
}),30000;
});
Sub.js:
const mqtt = require("mqtt");
var client = mqtt.connect("mqtt://broker.hivemq.com");
client.on("connect",function()
{
client.subscribe("Shirish");
console.log("Client subscribed ");
});
client.on("message",function(topic, message){
console.log(message.toString());
});
Using local broker:
![]() |
| HiveMQ for MQTT |
Pub.js:
const mqtt = require("mqtt");
var client = mqtt.connect("mqtt://127.0.0.1:1883");
client.on("connect",function()
{
setInterval(function(){
var random = Math.random()*50;
console.log(random);
if(random<30)
{
client.publish("Shirish","temperature value: "+random.toString());
}
}),30000;
});
Sub.js:
const mqtt = require("mqtt");
var client = mqtt.connect("mqtt://127.0.0.1:1883");
client.on("connect",function()
{
setInterval(function(){
var random = Math.random()*50;
console.log(random);
if(random<30)
{
client.publish("Shirish","temperature value: "+random.toString());
}
}),30000;
});
5G Network Simulation in NS3 Using mmWave This post shows the installation of ns3mmwave in Ubuntu 24.04 and simulates 5G networks in ns3. In...