Most of your confusion seems to be related to your other duplicate question, which is the same as 3. above...:
prepend AS path usually running with route-map out to adjust outbound traffic from router which contain this option
I'm sorry, but you are mistaken; prepending your ASN out adjusts traffic inbound to your ASN.
Does prepend work with route-map in at all to adjust inbound traffic?
No, you don't prepend inbound, because you can only prepend with your own ASN. If you prepend your own ASN to inbound announcements, bgp would think this is a routing loop (because it sees its own AS in the AS-path) and drop the route.
Let's eliminate the confusion in the question...
neighbor x.x.x.x route-map FOO_out out adjusts traffic inbound to your ASN.
neighbor x.x.x.x route-map FOO_in in adjusts traffic outbound from your ASN; use local-preference or some other criteria to influence your outbound traffic.
ip prefix-list MATCH_ALL permit 0.0.0.0/0
match ip address prefix-list MATCH_ALL
! --> Prepend so other ASN don't prefer this path
! NOTE: don't do this... 20 prepends is absurd in the real world.
! Five or ten ASN prepends should be sufficient
set ip as-path prepend 65001 65001 65001 65001 65001 65001 65001 65001 65001 65001 65001 65001 65001 65001 65001 65001 65001 65001 65001 65001
match ip address prefix-list MATCH_ALL
! --> Set local-pref lower than 100, so we don't prefer this peer
set local-preference 50
router bgp 777
! insert other "normal" bgp configuration here, network statement, etc..
neighbor 192.0.2.2 remote-as 100
! --> AS100_out adjusts *inbound* traffic
neighbor 192.0.2.2 route-map AS100_out out
! --> AS100_in adjusts *outbound* traffic
neighbor 192.0.2.2 route-map AS100_in in
NOTE: Prepending is deceptive; it might seem like nobody should select a path if you have prepended a lot of ASNs to your announcements, but even if you did that's no guarantee that downstream routers won't send traffic to you over that prepended path. The reality is that internet routing is still a per-hop / per-ASN decision, and you're still somewhat at the mercy of the wisdom (or foolishness) of others. See below for an example.
Problems with AS-prepend traffic engineering
Strictly speaking, you loose complete control of inbound routing paths when you announce your prefix to multiple providers because there are independent routing decisions made downstream for return traffic to you. Furthermore, your announcements could even be modified by downstream providers after you send them.
This is one example of what can happen. Continuing with the example configuration shown above...
- Suppose you have AS 777; you got a portable address block (220.127.116.11/22) from AS 100.
- You are dual homed to both AS 100 and AS 200
- You have services that a company with Router A needs to access.
- Assume that AS 100 doesn't have a good link to you (maybe it's intermittently corrupting traffic due to physical-layer problems you haven't been able to fix). So you think to yourself, "I'll just prepend all my announcements to AS100 with a large number of ASNs so nobody will prefer the AS100 link until I can fix this".
The problem is that you only have complete control of your outbound routing decisions. You don't get complete control inbound... so let's suppose Router A's administrator doesn't know your link to AS100 is bad. They are dual-homed to AS200 and AS100, but AS100 offers much cheaper transit, per-Mbps; therefore Router A's engineer takes full routes from AS100 and only uses AS200 as a backup (taking only a default from them).
AS 100's engineering team decides to set a high local-pref for 18.104.22.168/22 announcements from you. As such , the combination of full routes at router A and AS 100’s local pref means that you’ve lost control for ingress traffic through AS 100 to AS 777.
To summarize, As the admin of AS 777, you can force AS 777’s egress traffic to Router A through AS 200, but traffic from Router A to 22.214.171.124/22 would still take AS 100 (because the best route is through AS 100, at Router A).