-3

I have a multi-IP addresses Server, a main IP 102.1.1.1 and a C segment 103.1.1.0/24 IP addresses on it.

when I use

wget www.google.com

can I assign my special ip address in my Server like ping?
if can not, why?

aircraft
  • 356
  • 1
  • 5
  • 16
  • 1
    Please Read The Fine Manual [`man wget`](https://www.gnu.org/software/wget/manual/wget.html#Download-Options) Does your version also offer a switch / option to select a specific IP-address / interface / device name ? If your wget version does not, consider the similar `curl` command [`man curl`](https://curl.haxx.se/docs/manpage.html). – HBruijn Apr 02 '19 at 12:44

2 Answers2

2

There is an option to force wget to use a specific address on the local host:

--bind-address=ADDRESS

So you would do something like that:

wget www.google.com --bind-address=102.1.1.1
Jonathan Rioux
  • 1,938
  • 6
  • 33
  • 57
-3

You can use --bind-address=ADDRESS (for example

wget https://www.example.com/ --bind-address=123.123.123.123

Or add IP and Domain to file /etc/hosts

127.0.0.1               localhost localhost.localdomain localhost4 localhost4.localdomain4
 ::1             localhost localhost.localdomain localhost6 localhost6.localdomain6
 123.123.123.123          www.example.com

This file check before DNS Server, if you assign an IP to a Domain, your domain will be resolve from that IP address and no matter what DNS is.