When I run brownie console the ganache-cli starts by default at 127.0.0.1 address. How to change this address to 0.0.0.0?
I've tried to modified config located at ~/.brownie/network-config.yaml. I've changed host and port in the following section
development:
- name: Ganache-CLI
id: development
cmd: ganache-cli
host: http://0.0.0.0
cmd_settings:
port: 8549
gas_limit: 12000000
accounts: 10
evm_version: istanbul
mnemonic: brownie
but after restart only port was updated correcly.
There are two ways to do this:
Edit the network
Add a new network with the URL you're looking for
Edit the network
brownie networks modity development host=http://0.0.0.0
Add a new network
brownie networks add development ganache-zero cmd=ganache-cli host=http://0.0.0.0 accounts=10 mnemonic=brownie port=8545
Or
brownie networks add Ethereum ganache-zero host=http://0.0.0.0:8545 chainid=1337
Related
I have a Django application that runs fine on Heroku. At this point, I'd like to start a second process that implements a daemon that exchanges data with other devices and populates the database of the Django app.
I implemented this second daemon as a custom command of a Django app, so in my Procfile I have
web: gunicorn portal.wsgi --log-file -
listener: python manage.py listen_to_devices
At this point I start the daemon with heroku ps:scale listener=1.
Devices are not able to connect. While debugging, I noticed that my app has several entries in the DNS, I guess for load balancing:
ottavio#debian:~$ nslookup xxx.herokuapp.com
Server: 192.168.69.2
Address: 192.168.69.2#53
Non-authoritative answer:
Name: xxx.herokuapp.com
Address: 52.51.85.80
Name: xxx.herokuapp.com
Address: 52.212.106.249
Name: xxx.herokuapp.com
Address: 54.171.30.127
Name: xxx.herokuapp.com
Address: 54.171.254.93
Name: xxx.herokuapp.com
Address: 54.194.235.52
Name: xxx.herokuapp.com
Address: 99.80.174.196
Name: xxx.herokuapp.com
Address: 52.18.173.71
Name: xxx.herokuapp.com
Address: 52.48.204.199
ottavio#debian:~$
So, I guess I am doing something wrong. Port 8080 does not seem to be open whenever I try to telnet to it.
How can I have my devices reach my daemon port?
How can I have my devices reach my daemon port?
You can't.
At least, you can't if you already have another process already listening for web traffic. Dynos with the web type are the only ones that can receive traffic from the internet, and Heroku only gives you a single $PORT to bind to.
Depending on what it does you might be able to run your daemon as a separate Heroku app, but generally speaking apps expect to see HTTP traffic.
I have Ganache GUI from appx from official website on my Windows 10. When I run Truffle or testrpc network in my console (WSL) and try to connect there from Ganache GUI in settings, I get error message next to the textbox with a port:
The port is used by another application; please change it
the port is from Truffle or testrpc. How can I connect there? Thank you.
Ganache UI runs an instance of Ganache CLI (i.e. simulated Ethereum instance previously called TestRPC). If you already have a console window open with an application on port 9545 then Ganache UI cannot start a new instance on that same port.
I add the following to my .zshrc or .bashrc file
# Get WSL Host IP
export WSL_HOST_IP="$(awk '/nameserver/ { print $2 }' /etc/resolv.conf)"
This allows me to surface my host ip, so commands in WSL2 can reach the localhost.
Now create a workspace in Ganache GUI and under the server HOSTNAME settings choose "0.0.0.0 - All Interfaces".
In your truffle project edit the truffle-config.js file and set your network development block to this:
development: {
host: process.env.WSL_HOST_IP,
port: 7545,
network_id: "*" // Match any network id
}
Now when you run truffle migrate, it should connect to the Ganache GUI.
These are the steps that worked for me:
Start ganache-ui
Configure truffle's network in truffle-config.js:
networks: {
development: {
host: "127.0.0.1", // Localhost (default: none)
port: 7545, // Standard Ethereum port (default: none)
network_id: "*", // Any network (default: none)
},
...
Run truffle console (NOT truffle develop)
I am new to mininet and I was trying to build a mininet topology which uses a remote SDN controller.
I tried using floodlight as the remote controller. I installed it and ran it and it is running on "localhost:6653". But it is also running on 192.168.122.1:6653 (And I have no idea why).
192.168.122.1 is my virbr0 interface's address. In my mininet VM which is in virtualbox i have two network adapters.
NAT
Host only adapter
And for host only adapter i have the following configuration.
Adapter settings:
Ipv4 address: 192.168.56.1 and net mask: 255.255.255.0
DHCP server settings: Sever ip= 192.168.56.100; net mask= 255.255.255.0; Lower bound Ip: 192.168.56.101; Upper bound Ip: 192.168.56.254
To avoid confusion i have added the screenshots as well.
I tried the following command to build my topology:
sudo mn --controller=remote,ip=192.168.122.1,port=6653
I get the following response from mininet
Unable to contact remote controller 192.168.122.1:6653
I have tried changing ip to 192.168.56.1 but that also didn't work.
Any kind of help will be appreciated.
Thanks.
As per your setup, I guess FLC is running on Host OS and mininet is running in Oracle VM.
Your Host-Only network is useful if you are trying to reach something deployed in VM from your Host Os.
It will not work other way around. Here you want to access FLC running on Host inside your VM.
I would suggest using Floodlight VM for Virtual Box. It has mininet and FLC inbuild.
Once imported. Start VM.
Credentials: floodlight/floodlight
Inside VM start FLC
Do ifconfig ithe n terminal and get IP
change to that IP in this
sudo mn --controller=remote,ip=192.168.122.1,port=6653
and execute, all will work fine.
You can access FLC in Host using above IP
I have a Django web server on a VirtualBox/Vagrant machine running Ubuntu.
I have followed this guide to create a Django project: https://docs.djangoproject.com/en/dev/intro/tutorial01/
I have a web server running at http://127.0.0.1:8000/ inside my guest machine. This is the first time I am running a Django web server. It is supposed to be a hello world app.
How can I access this web application from my host browser?
I have tried running ifconfig in the guest to get the IP that I should visit I found a promising IP address in inet addr.
But I have tried entering the following into my host browser and it didn't work.
http://inetaddrnumbers:8000/
How can I access the web server from my browser?
Try this.
Open the vagrant file (should be in the directory where you specified to create a new vagrant machine).
Search for config.vm.network. If you didn't setup the file earlier, it should be commented.
Change it to look something like this config.vm.network "private_network", ip: "55.55.55.5". Here ip address (55.55.55.5) can be any ip address you want.
Now logout from the vagrant machine and reload your vagrant machine by this command vagrant reload.
Again ssh to your vagrant machine and restart your django server by this command python manage.py runserver 0.0.0.0:80. Again the port address (80) can be 8000 if you want so.
After that, in your browser, enter the following address 55.55.55.5, and hopefully you should see your webapp.
Now if you would like to go further, you can edit your host file, and add this line
55.55.55.5 mynewdomain.com
Then in your browser, enter the follow address,
mynewdomain.com
And you should see your web app. Note that, www is not added in the domain name inside the host file, so only mynewdomain.com can be accessed. You can however add it.
Hope this helps. Cheers.
Complementing #Kakar answer, this configuration can also be done using this:
config.vm.network "private_network", type: "dhcp"
This will assign an IP automatically.
For further reading: https://www.vagrantup.com/docs/networking/private_network.html
I am new to EC2 and web development. Currently I have a Linux EC2 instance running, and have installed Django. I am creating a test project before I start on my real project and tried running a Django test server.
This is my output in the shell:
python manage.py runserver ec2-###-##-##-##.compute-1.amazonaws.com:8000
Validating models...
0 errors found
Django version 1.3, using settings 'testsite.settings'
Development server is running at http://ec2-###-##-##-##.compute-1.amazonaws.com:8000/
Quit the server with CONTROL-C.
To test that it is wroking I have tried visiting: ec2-###-##-##-##.compute-1.amazonaws.com:8000 but I always get a "Cannot connect" message from my browser.
Whenever I do this lcoally on my computer however I do successfully get to the DJango development home page at 127.0.0.1:8000. Could someone help me figure out what I am doing wrong / might be missing when I am doing this on my EC2 instance as opposed to my own laptop?
Using an ec-2 instance with Ubuntu, I found that specifying 0.0.0.0:8000 worked:
$python manage.py runserver 0.0.0.0:8000
Of course 8000 does need to be opened for TCP in your security group settings.
You probably don't have port 8000 open on the firewall. Check which security group your instance is running (probably "default") and check the rules it is running. You will probably find that port 8000 is not listed.
1) You need to make sure port 8000 is added as a Custom TCP Rule into your Security Group list of inbound ports
2) Odds are that the IP that you see listed on your AWS Console, which is associated to your instance is a PUBLIC IP OR a PUBLIC Domain Name(i.e. ec2-###-##-##-##.compute-1.amazonaws.com or 174.101.122.132) that Amazon assigns.
2.1) If it is a public IP, then your instance has no way of knowing what the Public IP assigned to it is, rather it will only know the its assigned Local IP.
2.2) To get your Local IP on a Linux System, type:
$ ifconfig
Then look at the eth0 Data and you'll see an IP next to "inet addr" of the format xxx.xxx.xxx.xxx (e.g. 10.10.12.135) This is your Local IP
3) To successfully runserver you can do one of the following two:
$ python manage.py runserver <LOCAL IP>:8000
or
$ python manage.py runserver 0.0.0.0:8000
** Option Two also works great as Ernest Ezis mentioned in his answer.
EDIT : From The Django Book : "The IP address 0.0.0.0 tells the server to listen on any network interface"
** My theory of Public IP could be wrong, since I'm not sure how Amazon assigns IPs. I'd appreciate being corrected.
I was having the same problem. But I was running RHEL on EC2. Besides from adding a rule to security group, I had to manually add a port to firewalld.
firewall-cmd --permanent --add-port=8000/tcp
firewall-cmd --reload
That worked for me! (Although no idea why I had to do that)
Yes, if you use quick launch EC2 option, you should add new HTTP rule (just as it appears on the list) to run a development server.
Adding a security group with the inbound rules as follows usually does the trick unless you have something else misconfigured. The port range specifies which port you want to allow incoming traffic on.
HTTP access would need 80
HTTP access over port 8000 would need 8000
SSH to server would need 22
HTTPS would need 443